PHP 7.1.0 Released

Installation manuelle de PHP sous Windows

Choix du serveur Web

  • IIS est fourni avec Windows. Sur un serveur Windows, utilisez Server Manager pour ajouter le rôle IIS. Assurez-vous d'inclure la fonctionnalité CGI Role. Sur les bureaux Windows, utilisez le centre de contrôle d'ajout/suppression de programmes pour ajouter IIS. Voir : » https://msdn.microsoft.com/en-us/library/ms181052%28v=vs.80%29.aspx?f=255&MSPPError=-2147217396 Pour les applications web bureau et web développement, vous pouvez aussi utiliser IIS/Express ou PHP Bureau

    Exemple #1 Ligne de commande pour configurer IIS et PHP

        
        @echo off
    
        REM télécharger le fichier .ZIP de PHP depuis http://windows.php.net/downloads/
        REM
        REM chemin vers le dossier dans lequel on va décompresser le fichier.ZIP de PHP
    set phpdir=c:\php
    set phppath=php-5.6.19-nts-Win32-VC11-x86
    
    REM Nettoyage des gestionnaires PHP courant
    %windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI']
    
    REM Mise en place du gestionnaire PHP
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='%phpdir%\%phppath%\php-cgi.exe']
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phpdir%\%phppath%\php-cgi.exe',resourceType='Unspecified']
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script
    
    REM Configuration des variables FastCGI
    %windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='%phpdir%\%phppath%\php-cgi.exe'].instanceMaxRequests:10000
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phpdir%\%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']"
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phpdir%\%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phpdir%\%phppath%\php.ini']"
    
    
    Comment configurer manuellement IIS

  • Il y a plusieurs versions d'Apache2 pour Windows. Nous supportons ApacheLounge, mais les autres options incluent XAMPP, WampServer et BitNami, qui fournissent des outils d'installation automatique. Vous devriez utiliser mod_php ou mod_fastcgi pour charger PHP dans Apache. Si vous utilisez mod_php, vous DEVEZ utiliser une version TS de Apache, compilé avec la même version de Visual C et le même CPU (x86 ou x64). Comment configurer manuellement Apache2

Choix de la version

Téléchargez la version de production de PHP depuis » http://windows.php.net/download/. Beaucoup de test et d'optimisation ont déjà été faits sur la version instantannée et les versions QA, mais vous êtes les bienvenus pour nous aider à faire encore plus. Il y a 4 types de versions de PHP :

  • Thread-Safe(TS) - utilisé pour des serveurs web n'ayant qu'un seul processus, comme Apache avec mod_php

  • Non-Thread-Safe(NTS) - utilisé pour IIS et les autres serveurs web FastCGI (Apache avec mod_fastcgi) et c'est la version recommandée pour les scripts en ligne de commande

  • x86 - version de production de PHP 5.5 ou 5.6 ou 7.0.

  • x64 - version de production pour PHP 7.0+ tant que le système Windows n'est pas 32-bit seulement. PHP 5.5 et 5.6 x64 y sont expérimentaux.

add a note add a note

User Contributed Notes 26 notes

up
15
Michael W
1 year ago
May seem silly, but to follow up on Aditya's helpful tip make sure to download Visual C++ that corresponds to the version of PHP you installed or else you will have failure. http://www.microsoft.com/en-us/download/details.aspx?id=30679. The link he posted took me to a 64-bit version of the install ( I assume it was 64 bit because my OS is 64 bit).
up
10
Daniel
10 years ago
Re: Manual Configuration, pathing errors in IIS and ISAPI setup

Chris @ 11-Oct-2006 and phpmanual at pbb dot dds dot nl @ 07-Oct-2004 are both correct.

Problem is not with PHP but with IIS (mine is v5.1).

Installed PHP into C:\Program Files\PHP, and set environment variable PATH to path as stated.

When selecting the installation of php5isapi.dll via IIS Administrator, IIS would insert the path as:

"C:\Program Files\PHP\php5isapi.dll" (note the quotes and space in directory name)

All scripts ran and produced a HTTP 500 error.

Replaced ISAPI path in IIS with:

C:\PROGRA~1\PHP\php5isapi.dll (note the removal of the quotes and spaces, and the replacement of the path with 8.3 format names)

All scripts ran w/o problems.

Thanks to all! I hope someone can report if a similar problem exists with IIS6/7.
up
1
some dude @ some place
11 years ago
on two recent installation attempts on iis6 on win2k3 i followed the php manual and windows configuration steps exactly and php would still not run.

on the first install i had to give the USER account (not IUSR) read execute permissions to this file, c:\php\sapi\php4isapi.dll. using filemon i saw that it was being accessed and access was denied.

steps:
- right click on this file > properties > security > add > location (select the server -not domain if listed) > advanced > find now > Users (usually the last item) > click OK
- select Read & Execute > apply

also a complete computer restart was required in each install
up
-5
dkflbk at nm dot ru
7 years ago
There is a way to install PHP with nginx-server under windows (current version is 0.7.60)

Step-1 (install nginx server)
Just extract nginx-0.7.60.zip in C:\nginx-0.7.60

In C:\nginx-0.7.60\conf\nginx.conf uncomment and edit following lines

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  C:/nginx-0.7.60/html$fastcgi_script_name; #this is the one line for edition
            include        fastcgi_params;
        }

and run C:\nginx-0.7.60\nginx.exe (the server is started)

Step-2 (install PHP5)
Just extract php in C:\PHP5

Create (or modify) php.ini

extension_dir="ext/" ;for extensions

And run C:\PHP5\php-cgi.exe -b 127.0.0.1:9000
up
-3
dr dot juanc at yahoo dot com
9 years ago
Installing PHP5.2.1 in IIS 6.0 bring me some troubles too.

First i need to use full tag to make it your php script works and second the IIS didn't want to load the extension in the ext folder. I cheked the configuration a couple of thousand of time and everything seen to be ok.

I fixed up given read access in the "ext" folder to de "IUSER/PCNAME" user or to everyone/PCNAME user to the same folder. Just in case i did the same in the rest of the folder inside the php folder.

I wish nobody loose an all day in the same thing, like me.

excuse my english please
up
-4
Ben
10 years ago
In the Note Titled "Windows Server 2003 (x64 bits) + IIS 6.0" in step 1 when adding your new .php extension, it will not work unless after you click on the "Home Directory" you make sure that your "Execute permissions:" are set to "Scripts Only".

By default, on my machine, the permissions were set to "None" not allowing php to run.

Also, for more security it might be wise to Add the new extension just to your default site instead of the whole Web Sites folder in IIS. This would only apply if you were hosting multiple sites and had a site you didn't want scripts to run on.
up
-6
adozolj at yahoo dot com
9 years ago
I got the 'Fatal Error: call to unindentified function mysql_connect()' and resolved it after many hours of troubleshooting. The problem has to do with the libmysql.dll file residing in multiple directories. It SHOULD only be in the php directory. So, erase the copy in mysql bin and the apache bin and restart apache. I hope this helps someone. if this doesn't help check out forums.mysql.com and search "Call to undefined function mysql_connect". (i got the solution to this problem from here)
up
-5
txyoji
7 years ago
php 5.1.6 zip package for windows does not include a module for apache2.2.

Use apache2.0.x or 1.3.x instead.
up
-3
Bill dot Rook at Gmail dot com
11 years ago
doc_root = ".;c:\inetpub\wwwroot" does seem to work with virtual websites. This might be a better option then commenting out the line.
up
-4
bill at onemeg dot com
8 years ago
Your PHP.INI file is not required to be in the C:\WINDOWS folder in XP.  The trick is to make sure that the PHP.INI can be found.  If you fail to reboot after adding the PHP folder to the path and creating the PHPRC environment variable, the file will likely not be found.  If you can't reboot, then try creating the registry entries as described in the following document:

http://www.php.net/manual/en/configuration.php

When you execute "phpinfo();" pay special attention to the data returned in "Loaded Configuration File".  If it does not show a path and a the PHP.INI file name, the file is not being loaded.  The path of C:\WINDOWS in the Configuration File Path section is the default location where PHP looks for the INI file and does not mean that the file must be located there; in fact, the following document suggest that you leave the configuration file in the C:\PHP folder:

http://www.php.net/manual/en/install.windows.manual.php
up
-5
supportatradiormidotcom
8 years ago
Im running Win 2003 PHP 5 with the isapi.dll thanks to this sipmle tutorial hope it will help someone.Cerdit goes to Peterguy.

http://www.peterguy.com/php/install_IIS6.html

Follow the instructions, PHP install made easy
up
-5
patatraboum at nospam dot com
10 years ago
IIS + PHP

- The browser can't find your php code like localhost/dir/dir_code.php from any virtual directory (404 error)
- You are sure the code exists
You may rename it with a .html extension and check if it displays
- Process of your php code like localhost/root_code.php is ok from the root directory

It may come from the doc_root directive in php.ini whitch should be set to blank :

doc_root =

Then restart IIS to reload php.ini
up
-4
fgabrieli at gmail dot com
9 years ago
Problem:
Error in my_thread_global_end(): 1 threads didn't exit

It seems that php 5.2.3 libmysql.dll does not work as expected, because Apache shows this error in the logs when we use mysql_*() functions

Solution:
I found it here:
http://forums.mysql.com/read.php?10,153077,155121#msg-155121

which is to replace 'libmysql.dll' file in your PHP installation directory (also in winnt/system32 if you copied it there) with the Dll from PHP 5.2.1

You can download the second one from here:
http://www.php.net/get/php-5.2.1-Win32.zip/from/a/mirror

Regards,
Fernando Gabrieli
up
-3
philmee95 at gmail dot com
8 years ago
64 bit windows issues. PHP is 32 bit, and w3svc can only run under 32 or 64...not both. You will have to set 32 bit compat mode.
http://www.iisadmin.co.uk/?p=14
up
-7
hkhasgiwale at gmail dot com
9 years ago
I wasted a lot of time trying to figure out the problem of not being able to display my 'test.php' demo script to work, the file lay in my IIS 5 " C:\inetpub\wwwroot" folder.

The file contents of test.php were:
<?php>
phpinfo();
<
?>

Windows php installer version was 5.2.0

Problem lay in the minute dumb feature of windows explorer being used t change(rename) text file extension from 'test.txt' to 'test.php'.
The resultant name looked by the IIS was still 'test.php.txt'.

I used command line to change the filename to 'test.php' and it displayed in my browser.

http://localhost/test.php, worked right away.
up
-6
Jason Greene
10 years ago
If you are running websites within an Application Pool (which is now the default for IIS6 under 2K3) you need to make sure that your PHP directory (e.g. C:\PHP) has read permissions for the user assigned to the Application Pool.

1. In the IIS snap-in, choose Application Pools
2. Right-click on DefaultAppPool (or other, if you have one defined) and choose Properties
3. Click the Identity tab
4. Make a note of the user name set as the security account for this application pool (e.g. "Network Service")
5. Browse to your PHP directory and grant that user read permissions for the entire directory.

In my case, I had to add permissions for the user "NETWORK SERVICE" to get PHP scripts to work. Otherwise I received 401/403 authorization errors when trying to load them in a remote browser.

Note also that first tried adding IUSR permissions to the PHP directory, but that had no effect.
up
-5
cpz at akik-ffm dot de
11 years ago
In the above, "the web server's directory" means the directory where the server executable lives, for example for the Apache installation on my XP box this is "\program files\apache group\apache2\bin" and NOT just "\program files\apache group\apache2".

But it's probably best to tell your web server where PHP's ini file is stored, for example via PHPIniDir for Apache's http.conf.
up
-7
Chris
10 years ago
RE:  phpmanual at pbb dot dds dot nl  @ 07-Oct-2004 11:29

You are correct.  I just had the same issue; I was following the PHP installation instructions and some very helpful WIMP instructions.

I was trying to keep things tidy by putting my PHP directory in C:\Program Files\PHP.  I set the PATH variable, ISAPI filter config and extension in Application Configuration, but was getting the "Specified module could not be found" error.

Changed the PHP directory to C:\PHP and reconfigured everything, did an iisreset, and it started working immediately.

Good catch, and thank you!
up
-7
phpmanual at pbb dot dds dot nl
12 years ago
Okay, I'm a total newbie to this, so my findings may be wrong, but this is what I found out.

The manual says "do not have spaces in the path (like C:\Program Files\PHP) as some web servers will crash if you do". Indeed, when using this with PHP5 on WinXP, I got the error message "The specified module could not be found."
However, the problem seems not to lie in the SPACE in the pathname, but in the QUOTES that Windows adds when a space is in the pathname! This is what I found:

"C:\Program Files\php5\php5isapi.dll" -- doesn't work
C:\php5\php5isapi.dll -- works
"C:\php5\php5isapi.dll" -- doesn't work
C:\Progra~1\php5\php5isapi.dll -- works
"C:\Progra~1\php5\php5isapi.dll" -- doesn't work
C:\Program Files\php5\php5isapi.dll -- doesn't work, because it's not accepted by Internet Information Services

I don't know if this all is a problem with Internet Information Services or with PHP, but it would be nice if it was more documented in the PHP manual.
up
-6
php dot user dot com
12 years ago
After having the same problem as specifed below with "No input file specified". I changed the doc_root as mentioned.

This is fine if all php scripts are going to be run from the c:\inetpub\wwwroot directory. To enable it for multiple websites where the root directories are all different simply leave the doc_root attribute in the php.ini file blank.

This is for the isapi version not cgi implementation. It also means you don't have to set IUSR or IWAM access to the PHP root directory.
up
-4
atomictaco at atomic-taco dot com
11 years ago
In response to phpmanual at pbb dot dds dot nl:

You are absolutly correct.  I found this out while trying to install PHP4 with Apache2 on XPPro.  Here are 3 general guidelines that I have found to be correct:

- Path may not have spaces.  Change C:\Program Files to C:\Progra~1  If you don't understand this, go to start-->run-->command (not cmd).  Type cd\ and hit enter.  Then type dir.  You should see all your directory names there.

- Paths should not be enclosed by quotes.

- Use forward slashes (/) and not backslashes (\)
up
-7
jp at pulgadascubicas dot com
5 years ago
Trying to install PHP 5.3.3 VC9 Non-Thread-Safe on Windows 2008 Server running IIS 7.5.

Followed the instructions carefully but still got a 500 error trying to open the classig phpinfo page. After a lot of searching I discovered that everything worked fine after changing the php.ini directive fastcgi.logging from 0 to 1, contrary to what the directions said. I wonder if it was a typo on the instructions or if something changed after a few versions.

Hope this saves someone a couple of hours of searching.
up
-8
ik2008 at sipvantage dot com
8 years ago
In windows XP, the php.ini file must be in c:\windows directory. Or else most of the functions will work except mysql functions. The very first mysql command mysql_connect will fail with the following message "Call to unsupported or undefined function mysql_connect(); "
up
-6
5622477 at qq dot com
1 year ago
System: windows 10 x64
php: php-5.6.12-Win32-VC11-x86
apache lounge: httpd-2.4.16-win32-VC11

PHP installing as an Apache handler.

'extension_dir=<path to extension directory>'

The path must be absolute (i.e. "C/php/ext"), if you use relative (i.e."./ext") this effect on command line environment, but don't effect in Apache environment.
up
-4
chuacheehow at gmail dot com
12 years ago
My experience with IIS 5.1 is that the doc_root directive be commented in order for virtual directories to recognise PHP files (with PHP installed as CGI).
up
-6
v_moral at hotmail dot com
5 years ago
Problems setting up PHP as an Apache module under Windows?

To install php+apache+win32+mysql with PHP as an Apache module consider the following hints :

- download the 'VC6 x86 Thread Safe' zip file from http://windows.php.net/download/ .
Couldn't make the Non Thread Safe version to work as a loadable module from Apache.

- if you set extension=php_mysql.dll and still have problems, copy the file  libmysql.dll (shipped with php's zip) to your WINDOWS\System32\ directory.
The apache-mysql module fails trying to find this library.
To Top