November 20, 2008

How To Install PHP 5.2

NOTE: At this point you should already have Apache 2.2 installed on a Windows PC. At the time of this writing, PHP was on Version PHP 5.2.6

Installing PHP



  1. First things first, you need to download the latest version of PHP at http://www.php.net/downloads.php. This actually can be an overwhelming process for the first time PHP installer. There is 8 download options to choose from, but for now we are going to concentrate on just the first 2. The Zip Package and the Installer.
    • MSI Installer - This is the easiest way to install PHP and it will install, then load nearly every default extension dll available. This is the one I will be explaining.
    • The Zip Package - Download the zip package if you are looking to upgrade to a new minor release version. For instance, if you have PHP 5.2.5 installed, download the Zip Package, rename the Original PHP directory to PHP_old and then name the extracted zip package to PHP and copy it in place of the old version. You will then need to copy the PHP.ini file from the old to the new. This is located in the PHP root.
  2. After you have downloaded the latest MSI version, double click the MSI to start the Install Wizard.
  3. Change the Install directory to C:\PHP if you want to keep it consistent with your Apache installation
  4. If you installed Apache 2.2 earlier, you will need to select the Apache 2.2.x Module when prompted on the Web Server Setup screen
  5. You will then be prompted to locate the Apache Configuration directory. This is where the httpd.conf file is located. If you followed my Apache Installation instructions, it will be located in C:\Apache\Apache2.2\conf. (During the installation of PHP, the httpd.conf file will be updated to include the PHPIniDir and the LoadModule directives)
  6. When prompted to Choose Items to Install, click the box next to Extensions and select Entire feature will be installed on local hard drive
  7. Repeat the same for Extras
  8. Finish going through the Install wizard

CAUTION

If you read this far, you are in luck. Following the above installation instructions will inevitably end in frustration if you don't read this.

When you install PHP to the fullest extent, you will get every possible PHP extension or your hard drive and unfortunately, each one is added to the PHP.ini configuration file. This wouldn't be a problem if they would all load without errors, but this isn't the case. Many extra Extension dll's are loaded that will not run properly without their counter parts installed as well. This causes errors and you are not able to load PHP pages. You need to open the php.ini file which is located in the root directory (C:\PHP) where you installed PHP to and scroll to the bottom of the file comment out the extensions that are listed below. Also, take this time to look over the options available to setup your PHP the way YOU want it. Basically, to use the basic functionality of PHP, you don't even need to load any of the dlls. The extension dlls give you added functionality like the php_mysql.dll which gives you access to the MySQL functions. Below is a list of all the Extensions that need to be commented out with a semi colon (;):

[PHP_OCI8]
;extension=php_oci8.dll
[PHP_PDO_OCI]
;extension=php_pdo_oci.dll
[PHP_PDO_OCI8]
;extension=php_pdo_oci8.dll
[PHP_PDO_PGSQL]
;extension=php_pdo_pgsql.dll
[PHP_PDO_SQLITE]
;extension=php_pdo_sqlite.dll
[PHP_PDO_SQLITE_EXTERNAL]
;extension=php_pdo_sqlite_external.dll
[PHP_PGSQL]
;extension=php_pgsql.dll
[PHP_PSPELL]
;extension=php_pspell.dll
[PHP_SNMP]
;extension=php_snmp.dll
[PHP_SYBASE_CT]
;extension=php_sybase_ct.dll
[PHP_DOMXML]
;extension=php_domxml.dll
[PHP_IBM_DB2]
;extension=php_ibm_db2.dll
[PHP_IFX]
;extension=php_ifx.dll
[PHP_IISFUNC]
;extension=php_iisfunc.dll
[PHP_INGRES2]
;extension=php_ingres2.dll
[PHP_MAXDB]
;extension=php_maxdb.dll
[PHP_MCVE]
;extension=php_mcve.dll
[PHP_NETOOLS]
;extension=php_netools.dll
[PHP_ORACLE]
;extension=php_oracle.dll
[PHP_PDO_IBM]
;extension=php_pdo_ibm.dll
[PHP_PDO_INFORMIX]
;extension=php_pdo_informix.dll
[PHP_SAM]
;extension=php_sam.dll
[PHP_SPL_TYPES]
;extension=php_spl_types.dll
[PHP_THREADS]
;extension=php_threads.dll

No comments:

Post a Comment