Sunday, August 4, 2013

Resolution for issues faced during PHP installation


1. Apache web server Installation

       Download MSI installer for windows (Filename - "httpd-2.0.65-win32-x86-openssl-0.9.8y.msi") from apache website "http://httpd.apache.org/download.cgi#apache22".
       After installing apache server 2.0.65, when trying to start the server using Apache Monitor the server was failing. After investigation we found that the port 80 was being used by another application (In this case it was Skype). The solution for this issue was to disable using port 80 in Skype settings. After this server started successfully.

2. PHP Installation

        Download MSI installer for windows (Filename - "php-5.2.17-Win32-VC6-x86.msi") from php website "http://windows.php.net/download/". Ensure to select VC6 x86 Thread Safe version which will download version compatible with Apache web server downloaded in step 1.
       Make below configuration entries in the apache conf file "httpd.conf" file to compile and load PHP module:
    
PHPIniDir "C:/php/"
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

3. MySQL Installation
    Download mysql installable from Oracle e-delivery website (Filename - "mysql-installer-web-community-5.6.13.0.msi" ).  Execute this installable to deploy MySql.

4. PHP - MySQL Integration
    When we created a sample PHP page to connect to MySQL database we encountered an error in connecting to MySQL database -
Could not connect: Access denied for user 'root'@'localhost' (using password: YES)

The solution was to reset the password  by executing below command from command prompt as an administrator -
mysqld -nt --init-file=C:\\mysql-init.txt

In file "C:\\mysql-init.txt" we set the new password with below contents-
UPDATE mysql.user SET Password=PASSWORD('passwd') WHERE User='root';
FLUSH PRIVILEGES;