Home arrow PHP arrow Page 3 - Installing PHP Under Personal Web Server
PHP

Installing PHP Under Personal Web Server


In this article, Jayesh shows us how to install and configure PWS (Personal Web Server) and a PHP interpreter.

Author Info:
By: Jayesh Jain
Rating: 5 stars5 stars5 stars5 stars5 stars / 20
February 17, 2003
TABLE OF CONTENTS:
  1. · Installing PHP Under Personal Web Server
  2. · Installing PWS
  3. · Installing PHP
  4. · Conclusion

print this article
SEARCH DEVARTICLES

Installing PHP Under Personal Web Server - Installing PHP
(Page 3 of 4 )

Download Windows binary for the latest version of PHP. Once you've downloaded it, unzip it into a C:\, rename the folder to "php".

Open the PHP.INI-DIST file from C:\PHP folder, locate the following line:

;cgi.force_redirect = 1

We need to uncomment this line and change the setting to 0 as shown below to run PHP under PWS, do the necessary changes and save the file as php.ini in your windows folder (C:\windows on my computer):

cgi.force_redirect = 0

Configuring PWS for PHP

There are two ways to configure PHP one to set up the PHP CGI binary and the other is to use the ISAPI module.

a) Using CGI Binary

Open pws-php4cgi.reg file in a text editor (you shall find this file in the sapi folder inside the php folder)

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
".php"="[PUT PATH HERE]\\php.exe"


Replace the [PUT PATH HERE] to the drive and folder where you have installed php eg c:\\php\\php.exe, so the new thing should look like

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
".php"="c:\\php\\php.exe"


Note: Backslashes should be escaped.

Save the file and double click it in the windows explorer window to add this registry entry to your system alternatively you can run regedit, click Registry menu, select Import Registry File and select the file we just saved.

Open the Personal Web Manager, click advanced, from the list of Virtual Directories select click Edit Properties check the execute checkbox and click OK. You can do the same process on any given directory you want to add PHP support to.





Donít forget to restart you system.

Note: If you get the following error, you forgot to give execute permission on that directory.



b) Using ISAPI Module

Open pws-php4isapi.reg in a text editor (you shall find this file in the sapi folder inside the php folder):

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
".php"="[PUT PATH HERE]\\php4isapi.dll"


Replace the [PUT PATH HERE] to the drive and sapi folder where you have installed PHP (eg c:\\php\\sapi\\php4isapi.dll).

Save the file and import this registry entry to your system also give execute permission on any directory, the steps to do that is show above (See Using CGI binary).

Testing PHP under PWS

Open your favorite text editor and create a text file and type the following in it:

<?php
  phpinfo();
?>


phpinfo() is a PHP function which outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment, the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.

Save this file as test.php in C:\inetpub\wwwroots (your default PWS Web Root Folder)

Open you browser and type http://localhost/test.php in the address bar, click Go to see if you see output like the screen below to make sure PHP in configured and running properly.



If the source code appears in the browser and not the output we are expecting, then PHP has not been properly installed or PWS does not recognizes PHP files, please make sure you have followed the instructions properly.
blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials