← Back to DevelopmentAging & Mixing viewer.dll generatorProgramsClan filesInternet Information ServiceOllyDbg tutorialsMiscellaneousSkinsLinks / Files

Installing PHP 5.2 with PHP-ISAPI

← Back to Internet Information Service1. Installing PHP2. Configuring IIS to run PHP3. Testing if PHP works4. Allowing PHP to write files5. Errors and solutions

1. Installing PHP

  1. Create a php folder on your hard drive. It'll contain the installation of PHP. For me, it'll be C:\php
  2. Create a php_run folder on your hard drive. It'll contain the files created while PHP is running (logs, session files, temporary files for uploads). For me, it'll be C:\php_run
  3. Go to the PHP website and download the Windows binaries. In this tutorial I'll be using the 5.2.11 binaries. Also i'm not of fan of installers, so i'll take the .zip package (PHP 5.2.11 ZIP package).
    Note: Make sure you're not downloading the Source code unless you have some time to waste and a tool to compile it.
  4. Inside the php_run folder, create three new folders :
    • session
    • upload
    • log
  5. Extract the content of the ZIP package inside the php folder.
  6. Inside the php folder, you'll find a file called php.ini-recommended. Copy it and rename it php.ini.
  7. Copy the php.ini file inside the C:\WINDOWS\ folder.
    Note: To access it easily after, you can make a shortcut to that file on your desktop.
  8. Edit the php.ini to configure PHP :
    Note: If a line starts with a semi-colon (;), it means it's commented out. Don't forget to remove it to make the line active.
    • [OPTIONAL] If you're using an old account manager written with short tags (<? ), edit :
      
      			
    • Check the memory limit, default setting is 128M, it should be more than enough for your scripts :
      
      			
    • [OPTIONAL]If you're developping and you want to see the PHP errors, edit :
      
      			
    • Configure the PHP error log path :
      
      			
    • Configure the extension folder path :
      
      			
    • Configure the temporary upload files path :
      
      			
    • Configure the session files path :
      
      			
  9. Save the file

2. Configuring IIS to run PHP

  1. Open the IIS manager
  2. Select the Extensions folder and click Add a new extension

    019.jpg

  3. Name the extension PHP5ISAPI (or whatever you want to name it). Add the required file php5isapi.dll located inside your php folder. Set the extension status to Allowed and press Ok

    020.jpg

  4. Do a right click on your website and open its Properties

    021.jpg

  5. Select the Base directory tab and press Configuration

    022.jpg

  6. Press Add

    023.jpg

  7. Select the php5isapi.dll file located inside your php folder. Set the extension to .php and press Ok

    024.jpg

  8. Press Ok until your back to the manager.
  9. Reload the Application pool

    025.jpg

3. Testing if PHP works

  1. Create a file called php.php inside your web folder
  2. Paste this code inside it and save it

    PHP

    
    	
  3. Access it from your server : http://127.0.0.1/php.php
  4. It should display "Hello PHP world"

4. Allowing PHP to write files

Note: If you changed the IIS user for anonymous connections to Administrator to allow PHP to write content, it's not a good idea because if one of your scripts is compromised, it can access any file on your server with maximum privilege.

  1. Inside your website folder, create a file called test.txt and put some random text in it
  2. Inside your website folder create a file named get.php
  3. Paste this code inside it and save it

    PHP

    
    	
  4. Access it from your server : http://127.0.0.1/get.php
  5. It should display the content of test.txt
  6. Inside your website folder create a file named put.php
  7. Paste this code inside it and save it

    PHP

    
    	
  8. Access it from your server : http://127.0.0.1/put.php
  9. It should display Error. If you open the php.log file inside your php_run folder, you'll see something like this :
    
    		As you can see, PHP isn't allowed to write content. That's because IIS is running on the Internet Guest account. That account was created when you installed IIS. It's named IUSR_YOUR_COMPUTER_NAME. For me it's IUSR_WIN2003TEST.
    	
  10. Open your website folder Properties
  11. Select the Security tab and press Add

    026.jpg

  12. Press Advanced

    027.jpg

  13. Press Search

    028.jpg

  14. Select the IUSR_YOUR_COMPUTER_NAME account and press Ok

    029.jpg

  15. Press Ok to add the account

    030.jpg

  16. Add the Write permission for the IUSR_YOUR_COMPUTER_NAME account

    031.jpg

  17. Access the put.php file again : http://127.0.0.1/put.php
  18. It should display success and content was added to the file test.txt
    Note: If you are using an account manager, you need to add the IUSR_YOUR_COMPUTER_NAME account and the Write permission to your server folder too. It allow PHP to update your .dat files.

5. Errors and solutions

  • The PHP page displays : %1 is not a valid Win32 application.
    This could mean that you are running a 64-bit Windows, and a 64-bit version of IIS 6. PHP is a 32-bit binary. You need to configure IIS to run 32-bit applications.
    Open a command prompt, and type :