Tuesday, April 23, 2013

Installing Apache with PHP

Configuring Apache:
  1. Open the httpd.conf file.  (/conf sub-directory)
  2. Use slashes / for paths.
  3. Change the DocumentRoot to point to the location of the root document folder. In the default httpd.conf file, point to "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs".
  4. Change the Directory path to match the one used in the previous step.
  5. Add to index.php to the DirectoryIndex.
  6. Append the following lines to the end of the httpd.conf file:
      LoadModule php5_module "c:/php/php5apache2_2.dll"
       AddType application/x-httpd-php .php
       PHPIniDir "C:/php"

 Configuring PHP:
  1. Rename php-ini-recommended.ini to php.ini.
  2. Uncomment the Windows include_path.
    Note: In the PHP.ini file, semicolons are used to denote that something is commented out. To uncomment a line, simply remove the semicolon.
  3. Update the doc_root to match the one that was set up in the httpd.conf file.
  4. Update the extension_dir to "C:\php\ext".
  5. Uncomment php_gd2.dll extension.
  6. Uncomment mysql.dll extension.
  7. Update the sessions.save_path to the Windows temporary files directory (i.e. C:\Temp).
  8. The PHP directory needs to be added to the Path Environment Variables.
  9. Restart Apache and test PHP on Apache.
      
      
      () ?>
     

      


       
        () ?>
       

       
Change localhost:
  1. Open the 'hosts' file with notepad. It can usually be found in c:/windows/system32/drivers/etc.
  2. Edit the end of the file to read:
         127.0.0.1 localhost
   127.0.0.1 testsite1