ServerSignature Off ServerTokens ProdNéanmoins, si vous voulez, via PHP, vérifier quelle version Apache (Numéro et 32 ou 64 bits) est utilisée, par exemple par la variable prédéfinie $_SERVER['SERVER_SOFTWARE'], il faut autoriser les versions et la signature, donc :
ServerSignature On ServerTokens FullCela donnera un résultat, pour $_SERVER['SERVER_SOFTWARE'], du genre :
Define APACHE24 Apache2.4-- Forcer l'utilisation IPv4
Listen 80par
Listen 0.0.0.0:80-- Ajouter éventuellement le support IPv6 (Si votre système le supporte)
Listen 0.0.0.0:80par
Listen 0.0.0.0:80 Listen [::0]:80-- Préciser le port (bien que ce soit la valeur par défaut) pour localhost pour faciliter les éventuels changements de port et ajouter une directive par défaut sur Off, là aussi pour faciliter les éventuels remplacements pour HostnameLookups dont la valeur par défaut est Off afin de préserver le traffic réseau des sites pour lesquels la recherche inverse n'est pas vraiment nécessaire.
ServerName localhostpar
ServerName localhost:80 HostnameLookups Off-- Par défaut, le dossier de base du serveur est accessible à tous - Ce n'est pas normal, il devrait être interdit à tous.
<Directory /> AllowOverride none Require all granted </Directory>par
<Directory /> AllowOverride none Require all denied </Directory>-- Correction « cosmétique » mais qui peut avoir son importance
AllowOverride Allpar
AllowOverride all-- On arrive maintenant au point important des autorisations de connexion qui sont de type Apache 2.2.x alors qu'elles devraient être Apache 2.4
# Require all granted # onlineoffline tag - don't remove Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 Allow from localhostpar
# onlineoffline tag - don't remove Require localÇa simplifie... Mais, le script PHP qui s'occupe de faire passer Online ou Offline est, lui aussi en Apache 2.2.x. Donc, pour que la modification ci-dessus ne pose pas de problèmes, il faut aussi modifier le fichier J:\wamp\scripts\onlineOffline.php
$onlineText = "# onlineoffline tag - don't remove Order Allow,Deny Allow from all"; $offlineText = "# onlineoffline tag - don't remove Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 Allow from localhost";par
$onlineText = "# onlineoffline tag - don't remove Require all granted"; $offlineText = "# onlineoffline tag - don't remove Require local";-- Duplication de la déclaration de fichier de log
CustomLog "logs/access.log" common CustomLog "J:/wamp/logs/access.log" commonpar
CustomLog "J:/wamp/logs/access.log" commonJ:/wamp/... est mon chemin d'installation, à modifier en fonction de votre installation.
#AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgzpar
AddEncoding x-compress .Z AddEncoding x-gzip .gz .tgz-- Améliorer les performances sous Windows
#EnableSendfile onpar
#EnableSendfile on # AcceptFilter: Sous Windows, none utilise accept() au lieu d'AcceptEx(), # et ne recycle pas les sockets entre les connexions. Ceci s'avère utile # pour les interfaces réseau dont le pilote est défectueux, ainsi que pour # certains fournisseurs de réseau comme les pilotes vpn, ou les filtres # anti-spam, anti-virus ou anti-spyware. AcceptFilter http none AcceptFilter https none-- On n'a pas besoin du SPM (Server Pool Management)
Include conf/extra/httpd-mpm.confpar
#Include conf/extra/httpd-mpm.conf-- En revanche on peut valider les icônes des dossiers :
# Fancy directory listings #Include conf/extra/httpd-autoindex.confPar
# Fancy directory listings Include conf/extra/httpd-autoindex.confDans ce cas, il faut aussi vérifier que le module afférent est chargé, donc vérifier que la ligne suivante, toujours dans le fichier J:\wamp\bin\apache\apache2.4.4\conf\httpd.conf, est bien décommentée (Pas de # au début), bien sûr, .
LoadModule autoindex_module modules/mod_autoindex.soÇa ne suffit pas, il faut aussi vérifier que les chemins sont bons dans le fichier J:\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-autoindex.conf ; ce doit être :
Alias /icons/ "icons/" <Directory "icons"> Options Indexes MultiViews AllowOverride None Require all granted </Directory>
<?php $phpConf['phpIniDir'] = '.'; $phpConf['phpExeDir'] = '.'; $phpConf['phpConfFile'] = 'php.ini'; $phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module'; $phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll'; $phpConf['apache']['2.2']['AddModule'] = ''; $phpConf['apache']['2.4']['LoadModuleName'] = 'php5_module'; $phpConf['apache']['2.4']['LoadModuleFile'] = 'php5apache2_4.dll'; $phpConf['apache']['2.4']['AddModule'] = ''; ?>Le fichier de configuration de php 5.4.16 : J:\wamp\bin\apache\apache2.4.4\bin\php.ini intègre des extensions qui n'existent plus et n'est pas dans le bon ordre, par exemple l'extension exif doit être après mbstring.
; Windows Extensions ; Note that ODBC support is built in, so no dll is needed for it. ; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) ; extension folders as well as the separate PECL DLL download (PHP 5). ; Be sure to appropriately set the extension_dir directive. ; extension=php_bz2.dll ;extension=php_com_dotnet.dll extension=php_curl.dll ;extension=php_enchant.dll extension=php_fileinfo.dll extension=php_gd2.dll extension=php_gettext.dll extension=php_gmp.dll extension=php_intl.dll extension=php_imap.dll ;extension=php_interbase.dll extension=php_ldap.dll extension=php_mbstring.dll extension=php_exif.dll ; Must be after mbstring as it depends on it extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client ;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client extension=php_openssl.dll ;extension=php_pdo_firebird.dll extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll ;extension=php_pgsql.dll extension=php_shmop.dll ; The MIBS data available in the PHP distribution must be installed. ; See [www.php.net] ;extension=php_snmp.dll extension=php_soap.dll extension=php_sockets.dll extension=php_sqlite3.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll extension=php_xmlrpc.dll extension=php_xsl.dll ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;;Certaines extensions sont validées (Pas de ; au début de la ligne) et seront chargées par PHP. Il vous appartient de valider ou dévalider les extensions pour vos propres besoins.
;error_log = "J:/wamp/logs/php_error.log"Par
error_log = "J:/wamp/logs/php_error.log"J:/wamp/... est mon chemin d'installation, à modifier en fonction de votre installation.
cgi.force_redirect = 1 cgi.fix_pathinfo=1c'està-dire avec un ";" (point-virgule) en début de ligne par
;cgi.force_redirect = 1 ;cgi.fix_pathinfo=1
date.timezone = UTCpar
date.timezone = Europe/Paris
;intl.default_locale =par
intl.default_locale = fr_FR ; This directive allows you to produce PHP errors when some error ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. intl.error_level = E_WARNINGAu sujet de l'internationalisation de PHP et des erreurs éventuelles PHP Warning : PHP Startup: in Unkonwn on line 0 voir la Notice 1 en bas de page
mysql.default_port =par
mysql.default_port = 3306
[PostgresSQL]par
[PostgreSQL]
; allow_call_time_pass_reference ; Default Value: On ; Development Value: Off ; Production Value: Off
; magic_quotes_gpc ; Default Value: On ; Development Value: Off ; Production Value: Off
; register_long_arrays ; Default Value: On ; Development Value: Off ; Production Value: Off
; session.bug_compat_42 ; Default Value: On ; Development Value: On ; Production Value: Off ; session.bug_compat_warn ; Default Value: On ; Development Value: On ; Production Value: Off
; Enforce year 2000 compliance (will cause problems with non-compliant browsers) ; [php.net] y2k_compliance = On
; This directive allows you to enable and disable warnings which PHP will issue ; if you pass a value by reference at function call time. Passing values by ; reference at function call time is a deprecated feature which will be removed ; from PHP at some point in the near future. The acceptable method for passing a ; value by reference to a function is by declaring the reference in the functions ; definition, not at call time. This directive does not disable this feature, it ; only determines whether PHP will warn you about it or not. These warnings ; should enabled in development environments only. ; Default Value: On (Suppress warnings) ; Development Value: Off (Issue warnings) ; Production Value: Off (Issue warnings) ; [php.net] allow_call_time_pass_reference = Off ; Safe Mode ; [php.net] safe_mode = Off ; By default, Safe Mode does a UID compare check when ; opening files. If you want to relax this to a GID compare, ; then turn on safe_mode_gid. ; [php.net] safe_mode_gid = Off ; When safe_mode is on, UID/GID checks are bypassed when ; including files from this directory and its subdirectories. ; (directory must also be in include_path or full path must ; be used when including) ; [php.net] safe_mode_include_dir = ; When safe_mode is on, only executables located in the safe_mode_exec_dir ; will be allowed to be executed via the exec family of functions. ; [php.net] safe_mode_exec_dir = ; Setting certain environment variables may be a potential security breach. ; This directive contains a comma-delimited list of prefixes. In Safe Mode, ; the user may only alter environment variables whose names begin with the ; prefixes supplied here. By default, users will only be able to set ; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). ; Note: If this directive is empty, PHP will let the user modify ANY ; environment variable! ; [php.net] safe_mode_allowed_env_vars = PHP_ ; This directive contains a comma-delimited list of environment variables that ; the end user won't be able to change using putenv(). These variables will be ; protected even if safe_mode_allowed_env_vars is set to allow to change them. ; [php.net] safe_mode_protected_env_vars = LD_LIBRARY_PATH
; Whether or not to register the EGPCS variables as global variables. You may ; want to turn this off if you don't want to clutter your scripts' global scope ; with user data. This makes most sense when coupled with track_vars - in which ; case you can access all of the GPC variables through the $HTTP_*_VARS[], ; variables. ; You should do your best to write your scripts so that they do not require ; register_globals to be on; Using form variables as globals can easily lead ; to possible security problems, if the code is not very well thought of. ; [php.net] register_globals = Off ; Determines whether the deprecated long $HTTP_*_VARS type predefined variables ; are registered by PHP or not. As they are deprecated, we obviously don't ; recommend you use them. They are on by default for compatibility reasons but ; they are not recommended on production servers. ; Default Value: On ; Development Value: Off ; Production Value: Off ; [php.net] register_long_arrays = Off
; Magic quotes are a preprocessing feature of PHP where PHP will attempt to ; escape any character sequences in GET, POST, COOKIE and ENV data which might ; otherwise corrupt data being placed in resources such as databases before ; making that data available to you. Because of character encoding issues and ; non-standard SQL implementations across many databases, it's not currently ; possible for this feature to be 100% accurate. PHP's default behavior is to ; enable the feature. We strongly recommend you use the escaping mechanisms ; designed specifically for the database your using instead of relying on this ; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is ; scheduled for removal in PHP 6. ; Default Value: On ; Development Value: Off ; Production Value: Off ; [php.net] magic_quotes_gpc = Off ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. ; [php.net] magic_quotes_runtime = Off ; Use Sybase-style magic quotes (escape ' with '' instead of \'). ; [php.net] magic_quotes_sybase = Off
; PHP 4.2 and less have an undocumented feature/bug that allows you to ; to initialize a session variable in the global scope, even when register_globals ; is disabled. PHP 4.3 and later will warn you, if this feature is used. ; You can disable the feature and the warning separately. At this time, ; the warning is only displayed, if bug_compat_42 is enabled. This feature ; introduces some serious security problems if not handled correctly. It's ; recommended that you do not use this feature on production servers. But you ; should enable this on development servers and enable the warning as well. If you ; do not enable the feature on development servers, you won't be warned when it's ; used and debugging errors caused by this can be difficult to track down. ; Default Value: On ; Development Value: On ; Production Value: Off ; [php.net] session.bug_compat_42 = On ; This setting controls whether or not you are warned by PHP when initializing a ; session value into the global space. session.bug_compat_42 must be enabled before ; these warnings can be issued by PHP. See the directive above for more information. ; Default Value: On ; Development Value: On ; Production Value: Off ; [php.net] session.bug_compat_warn = On
# binary logging is required for replication #log-bin=mysql-bin # binary logging format - mixed recommended #binlog_format=mixed-- Ne pas lancer le mode réplication, donc l'ajouter sous # Replication Slave (comment out master section to use this)
# Replication Slave (comment out master section to use this) # New for MySQL 5.6 if no slave skip-slave-start-- Ajouter le moteur (ENGINE) par défaut. InnoDB étant moins souple d'utilisation et sujet à quelques problèmes, nous allons choisir MYISAM, donc, ajouter les lignes suivantes :
# The default storage engine that will be used when create new tables # New for MySQL 5.6 default_tmp_storage_engine if skip-innodb default-storage-engine=MYISAM default_tmp_storage_engine=MYISAM-- Nous pouvons ajouter l'affichage des messages d'erreur en français
#Path to the language lc-messages-dir=J:/Wamp/bin/mysql/mysql5.6.12/share lc-messages=fr_FRJ:/wamp/... est mon chemin d'installation, à modifier en fonction de votre installation.
explicit_defaults_for_timestamp=true
Alias /phpmyadmin "J:/wamp/apps/phpmyadmin4.0.4/" # to give access to phpmyadmin from outside # replace the line # # Require local # # by # # Require all granted # <Directory "J:/wamp/apps/phpmyadmin4.0.4/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require local </Directory>Attention le chemin (2 fois) est celui de mon installation, à modifier pour la vôtre.
<?php /* Servers configuration */ $i = 0; $cfg['blowfish_secret'] = 'a8b7c6d'; //Ce que vous voulez /* Server: localhost [1] */ $i++; $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['AllowNoPassword'] = true; // Supprime l'avertissement aux sujets des tables pmadb $cfg['PmaNoRelation_DisableWarning'] = true; /* End of servers configuration */ ?>Nota : On peut remplacer "mysqli" par "mysql" (Néanmoins, mysql devient obsolète). Si "mysqli" est choisi, s'assurer que l'extension "php_mysqli" est validée pour être chargée.
<?php /* Servers configuration */ $i = 0; $cfg['blowfish_secret'] = 'a8b7c6d'; //Ce que vous voulez /* Server: localhost [1] */ $i++; $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'secret'; //$cfg['Servers'][$i]['AllowNoPassword'] = true;//À commenter ou à supprimer // Supprime l'avertissement aux sujets des tables pmadb $cfg['PmaNoRelation_DisableWarning'] = true; /* End of servers configuration */ ?>Fermez le navigateur et relancez PhpMyAdmin via l'icône de Wampserver. Vous DEVEZ avoir accès à PhpMyAdmin.
<?php /* Servers configuration */ $i = 0; $cfg['blowfish_secret'] = 'a8b7c6d'; //Ce que vous voulez /* Server: localhost [1] */ $i++; $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'http'; $cfg['Servers'][$i]['user'] = ''; $cfg['Servers'][$i]['password'] = ''; // Supprime l'avertissement aux sujets des tables pmadb $cfg['PmaNoRelation_DisableWarning'] = true; /* End of servers configuration */ ?>Lors du lancement de PhpMyAdmin, un formulaire vous demandera le nom utilisateur et le mot de passe.
Alias /phpmyadmin "J:/Wamp/apps/phpmyadmin4.0.4/"par
Alias /phpmyadmin "J:/Wamp/apps/phpmyadmin4.0.4.1/"ET
<Directory "J:/Wamp/apps/phpmyadmin4.0.4/">par
<Directory "J:/Wamp/apps/phpmyadmin4.0.4.1/">J:/wamp/... est mon chemin d'installation, à modifier en fonction de votre installation.
icudt??.dll icuin??.dll icuio??.dll icule??.dll iculx??.dll icutest??.dll icutu??.dll icuuc??.dll libeay32.dll libsasl.dll php5ts.dll ssleay32.dllNota : pour les noms des dll comme "icudt??.dll", le "??" du nom est à remplacer par :