PHP4HS Home

Php4Hs: Articles
Setting up PHP with OmniHTTPd

By Dan Delaney, daniel@delaney.net, July 2002

For those developers who want to develop PHP sites on a Windows setup, messing around with Personal Web Server or trying to get IIS working properly with PHP can prove too much hassle, and that's not even considering Apache or iPlanet. As a simple development environment, and as the host for low traffic sites, I recommend the use of OmniHTTPd.

OmniHTTPd has been around for a while, and I first used it as the basis for CGI development on Win98 & NT4 back in 1999. For more information on OmniHTTPd visit the Omnicron website - at the time of writing the latest version is 2.09

This is a step-by-step guide to installing OmniHTTPd, the latest PHP, and testing the PHP setup.

  1. Download the latest Windows binary from the PHP website. For the purposes of this setup, get the ZIP package, not the PHP installer. If you haven't already got one, you might require a program to extract ZIP files, such as Winzip

  2. Download the latest OmniHTTPd build from the Omnicron website.

  3. Install OmniHTTPd
    1. Start the OmniHTTPd installation
    2. When the installation of OmniHTTPd starts press 'Next', 'Yes' and 'Next' to accept the License Agreements.
    3. To change the destination folder, click Browse. For the purposes of this guide, I will assume OmniHTTPd is installed at the default destination (c:\httpd)
    4. Choose 'Typical' installation type. (For those who may wish to change some options, choose 'Custom' then click 'Next' but do not deselect 'PHP Support' at the next screen). Click 'Next'.
    5. If you're installing on Windows NT / 2000 / XP, you will be asked if you want to install OmniHTTPd as a service. I would recommend declining this, but it's up to you. It makes no particular difference in performance.
    6. Choose 'Next' on the program folder selection screen,
    7. The program will now install
    8. At the prompt 'Do you want OmniHTTPd to run automatically at startup', again this decision is up to you.
    9. By default, the next screen will have the options 'Yes, I want to read the README file.' and 'Yes I want to launch the server and browse my new site.' are selected. Deselect the 2nd option (launch server) as we do not want the server to run. If you don't want to read the README file, go ahead and deselect that option as well.
    10. Click 'Finish'

  4. Installing PHP ( so that OmniHTTPd will pick it up automatically )
    1. Open the ZIP package
    2. Ensure that 'keep folder names' is selected in your Open the OmniHTTPd installation folder in My Computer or Windows Explorer: c:\httpd
    3. Open My Computer or Windows Explorer and go to c:\httpd
    4. Rename the folder php to php-orig (or remove it if you don't want to keep a backup)
    5. Rename the new php folder (eg: php-4.2.1-Win32) to php
    6. Using notepad, open the file c:\httpd\php\php.ini-dist
    7. Press F3 and type - cgi.force_redirect = 1 - into the search box. Change the selected line:
      ; cgi.force_redirect = 1
      to read
      cgi.force_redirect = 0
    8. Using File > Save As, save the file as php.ini in your Windows directory ( usually c:\WINDOWS or c:\WINNT ). You may be prompted if you want to overwrite the existing file.. select 'Yes'.

  5. Checking your PHP installation
    1. Open Notepad, or some other text editor
    2. Type in the following PHP code:
      <?php
         phpInfo();
      ?>
    3. Save the file as c:\httpd\htdocs\phpTest.php
    4. Start OmniHTTPd ( Click on Start > Programs > OmniHTTPd Professional 2.0 > OmniHTTPd )
    5. Open a web browser and type in the following URL: http://127.0.0.1/phpTest.php or http://localhost/phpTest.php
    6. If all is well, you should get a long list detailing your PHP configuration with the build number at the top.

Configuration of OmniHTTPd to point at different directories for your web content, uses a very intuitive Administration interface. To use this interface, either right-click on the omnihttpd icon in your system tray (if you didn't install OmniHTTPd as a service) or by selecting the 'OmniHTTPd Administration' item from the OmniHTTPd Professional 2.0 folder in your Programs menu.

If you have any questions at any stage of this guide, or you find an error or omission, feel free to email them to me