PDA

View Full Version : HOWTO Manual Windows PHP Install


Milovan
05-10-2006, 08:48 AM
Here is a tutorial I wrote on how to manually install PHP on a Windows VPS (of course, this works for dedicated servers too). Keep in mind that you should only do this if you do not have Plesk for Windows control panel. Plesk for Windows has it's PHP already preinstall, so installing it this way will cause problems.

Login to the VPS and browse to http://www.php.net/downloads.php. Make sure to download PHP 4.4.2 zip package [8,110Kb] - 13 Jan 2006 and not the installer. This is very important.

Then browse to http://www.caraveo.com/fastcgi/ and dowload ISAPI/NSAPI binaries (11/03/2002).

When you're done with that, create a folder called PHP in C:\ and unzip php4.4.2 archive into C:\PHP\. Afterwards, copy "php4ts.dll" from C:\PHP\ (not cut/paste, just copy) to C:\Windows\System32\

Unzip the FastCGI binary and copy isapi_fcgi.dll into C:\PHP\

Then you need to add PATH for PHP. This is how you do it:

right-click My Computer -> Properties -> Advanced tab -> Environment Variables -> double-click the Path variable in the list of System variables.

At the end of the string add this:

;C:\PHP

do not put ; in front of C:\PHP if there is already one there. It should not look as ;;C:\PHP.

Now, you can run PHP as ISAPI or CGI. Here is how you do it for both cases:

----------------------------
running PHP as ISAPI
----------------------------

Open IIS, expand local computer and click on 'Web Service Extensions'. Click on 'Add a new Web service extension...' and for the name type in: "PHP ISAPI Extensions" (without the quotes), click 'Add...' button and select isapi_fcgi.dll in C:\PHP. Check 'Set extension status to Allowed' and click OK.

Now add .php extension so that IIS can serve .php files: right-click on 'Web Sites' in IIS, then choose Properties and click on Home Directory tab. Click 'Configuration', Mappings, click 'Add'. Browse to isapi_fcgi.dll in C:\PHP, click OK, and enter ".php" (without quotes) in the 'Extension field'. Select 'Limit to' button and enter: GET,POST,HEAD

Ok ok ok ok... endless OK clicking. Once you're out, right-click on Websites again and choose Properties and then Home directory. Change the "Execute permissions" dropdown to "Scripts only". Also make sure that the 'Read' is checked in permissions you'll see above. Click OK and select all sites and click OK once again.

Open the Windows registry (Start -> Run -> regedit) and do the following:

Locate and expand "HKEY_LOCAL_MACHINE", right-click on "Software" and select "New", "Key" and type "FASTCGI".

Right-click on your new "FASTCGI" key and select "New, "Key" and type ".php".

Right-click on ".php", select "New", "String Value" and type "AppPath". Double-click on this new value and type "c:\PHP\php.exe".

Right-click on ".php", select "New", "String Value" and type "BindPath". Double-click on this new value and type "php-fcgi".

Close the registry.

Rename C:\PHP\php.ini-recommended to php.ini and move it to C:\Windows\

Then open php.ini and locate "extension_dir" (CTRL+F). Make it like this:

extension_dir = "C:\PHP\extensions"

Save and restart IIS.

-------------------------
running PHP as CGI
-------------------------

Open IIS, expand local computer and click on 'Web Service Extensions'. Click on 'Add a new Web service extension...' and for the name type in: PHP CGI Extensions, click 'Add...' button and select php.exe in C:\PHP. Check 'Set extension status to Allowed' and click OK.

Now add .php extension: right-click on 'Web Sites' in IIS, then choose Properties and click on Home Directory tab. Click 'Configuration', Mappings, click 'Add'. Browse to php.exe in C:\PHP, click OK, and enter ".php" (without quotes) in the 'Extension field'. Select 'Limit to' button and enter: GET,POST,HEAD

Ok ok ok ok. Right-click on Websites again and choose Properties and then Home directory. Change the "Execute permissions" dropdown to "Scripts only". Also make sure that the 'Read' is checked in permissions you'll see above. Click OK and select all sites and click OK.

Open the Windows registry (Start -> Run -> regedit) and do the following:

Locate and expand "HKEY_LOCAL_MACHINE", right-click on "Software" and select "New", "Key" and type "FASTCGI".

Right-click on your new "FASTCGI" key and select "New, "Key" and type ".php".

Right-click on ".php", select "New", "String Value" and type "AppPath". Double-click on this new value and type "c:\PHP\php.exe".

Right-click on ".php", select "New", "String Value" and type "BindPath". Double-click on this new value and type "php-fcgi".

Close the registry.

Rename C:\PHP\php.ini-recommended to php.ini and move to C:\Windows\

Then open php.ini and locate extension_dir. Make it like this:

extension_dir = "C:\PHP\extensions"

Make sure that you disable force redirect, otherwise CGI won't work. To do so, find cgi.force_redirect (CTRL+F) and make it look like this:

cgi.force_redirect = 0

Save and restart IIS.

--------------------------------------------

Create a new file in c:\Inetpub\wwwroot called test.php and put <? phpinfo(); ?> in it. Load it in IE like http://localhost/test.php and you should see PHP output.

There you go, you have manually installed PHP on Windows.

john simpson
05-31-2006, 12:47 PM
I'm running a PowerVPS Windows account with Plesk. I'd like to upgrade the PHP to PHP5. Do you have any advice or documentation available on what I should do?

Thanks.

John

Milovan
06-01-2006, 05:25 PM
John,

It is not recommended by SWsoft to use PHP5 with Plesk since some elements of Plesk will be broken (such as Webmail, for instance). That being said, it is not possible to upgrade PHP through Plesk - you would have to do it manually (the above tutorial will work for PHP5 as well.

Hope that helps.