Looking for a JavaEE Architect or Potential Tech Co-Founder?
Please don't hesitate to contact me.

Apache php mysql setup

Everytime I setup a new unit I have to set the following up and it takes time. So I'm writing a walkthrough and hopefully I don't need to debug :-D.

Before we begin you must download and install/extract the following:
1.) apache - http://httpd.apache.org/download.cgi
2.) php (zipped) - http://php.net/downloads.php
3.) mysql - http://dev.mysql.com/downloads/

I override the default setup and installed in the c drive:
apache - C:\Apache2.2
mysql - C:\mysql51
php - C:\php-5.2.14

Install in order:
1.) mysql - run the installer and select the configuration that you want. Just don't forget to set the installation directory to c: drive.

2.) php - using the zipped installer, extract in c: drive.
Changes you should made with C:\php-5.2.14\php.ini
a.) rename php.ini-recommended to php.ini
b.) set the following:
i.) extension directory: extension_dir = "C:\php-5.2.14\ext"
ii.) upload directory: upload_tmp_dir = "C:\php-5.2.14\uploads"
iii.) upload size: upload_max_filesize = 16M
iv.) session directory: session.save_path = "C:\php-5.2.14\sessions"
c.) uncomment the extensions you need
i.) ;extension=php_mysql.dll -> extension=php_mysql.dll

3.) apache - I've used the installer version for this setup (not zipped)
You can name you server localhost
a.) server root should be: ServerRoot "C:/Apache2.2"
b.) port: Listen 80
c.) the most important, after the series of LoadModules, copy and paste these lines:

PHPIniDir "C:/php-5.2.14"
LoadFile "C:/php-5.2.14/php5ts.dll"
LoadModule php5_module "C:/php-5.2.14/php5apache2_2.dll"
AddType application/x-httpd-php .php

*The above lines set tells apache where to find php.ini, load the the php dll and module.
And add handler to .php file type.
d.) there are 2 instances of document root you should set them (mine is c:\cgipages):
i.) DocumentRoot "C:/cgipages" (find the other instance)
e.) to add a virtual directory:
i.) in this section <IfModule alias_module> add a line similar to:
Alias /webpath /full/filesystem/path
-> Alias /virtualroot "C:/Projects/eclipse/eclipse-helios-php/virtualroot"
ii.) now this is important, you must give apache/php right to the directory via:

<Directory "C:/Projects/eclipse/eclipse-helios-php/virtualroot">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>


Common Problems:
-The connection was reset
->Just copy libmysql.dll from php folder to apache/bin
Apache php mysql setup Apache php mysql setup Reviewed by Edward Legaspi on Sunday, October 03, 2010 Rating: 5

No comments:

Powered by Blogger.