Eway Business Solutions

Technology - Consulting - Outsourcing

Eway Business Solutions header image 2

Installing : Apache, PHP, MySQL & PHPmyAdmin

November 6th, 2007 · No Comments

Installing: Apache, PHP, MySQL & PHPmyAdmin.

Download Apache 2 Windows Binary (MSI installer)
The zip must end with win32-x86-no_ssl.msi.

Download the PHP zip package and PECL modules (PECL are extensions)
Although extensions should come in the PHP package found in the extracted Ext folder) The PHP zip is under “Windows Binaries”.
Download the zip pack, not the installer.

Download MySQL
Look for: “Windows Downloads”: MySQL Windows x86.

PHPmyAdmin
Download PHPmyAdmin

In case you are already running any flavor of PHP and MySQL start by stopping them.

Install Apache
We use the installer so it will come easy, just go with the flow!
But for “Install to a different folder”, we will use/create:
C:Program FilesApache Group this_will_be Apache2
(Created by extracting files)
First test:
Go to http://localhost/. It should show the default Apache index page in English.
In case of problem: Go to Start > All Programs > Apache and try to stop and start or restart (The “Monitor Apache Servers” utility may also appear in your Windows Taskbar System Tray by the clock, etc.).
Next edit the httpd.conf file using your favorite script editor.
“C:Program filesApache groupApache2confhttpd.conf”
Go to line 228, and change the docroot to:
DocumentRoot “C:/Program Files/Apache Group/Apache2/htdocs”
Go to line 253 and copy/paste the same dir as 228 but keep the “ <Directory “ first part
Save, and restart apache 2.

Install PHP5
Unzip the PHP zip to C:/PHP (Create the Dir PHP at C:/ root level) Next: Shut down Apache;
Crank up your favorite editor again and open the apache httpd.conf and add two lines of code:

LoadModule php5_module C:/php/php5apache2.dll
AddType application/x-httpd-php .php
<edit> Added .php extension to show how to parse .php files</edit>
I have added those two to the very bottom of the httpd.conf file.
<edit>Note: See Message 11 below on where to put the LoadModule directive!</edit>
Verify that the path in the LoadModule directive points to the dir where PHP is installed.

Next, copy/paste “php.ini-dist” to C:/Program Files/Apache Group/Apache2, and rename it to php.ini.

In order to get a working WAMP we need to copy from C:/PHP root and from C:/PHP/ext some DLLs to Apache2 root (Where you did paste your renamed copy of php.ini) those are:

fdftk.dll
fribidi.dll
gds32.dll
libeay32.dll
libmash.dll
libmysql.dll
libmysqli.dll
msql.dll
ntwdblib.dll
php5apache2.dll
php5apache.dll
php5apache_hooks.dll
php5isapi.dll
php5nsapi.dll
php5ts.dll
phpmsql.dll
phpmssql.dll
phpmysql.dll
phpmysqli.dll
ssleay32.dll
yas.dll

We need to set the PHP path for Windows:
Go to:
Control Panel > System > Advanced tab
Click on “Environment variables”
Look in the “System variables” pane
Find the “Path” entry
Double click it and add at the end of the string your PHP dir
You need to start with “;” without double quotes!
And follow by: C:php
So it will look like: “;C:php” Again, without double quotes!
Now restart the Apache server.
Test: Create a simple file such as php5_info.php

<? phpinfo();?>

Save it in C:/Program Files/Apache Group/Apache2/htdocs/php5_info.php
Open a browser and enter the following address http://localhost/php5_info.php it should display your complete PHP setting if it does not work properly you might have done something wrong with the multiple edits; check them out and give it another go.

Open up C:/Program Files/Apache Group/Apache2/php.ini. First, stop Apache
On line 276, you may change:

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
to
error_reporting = E_ALL

Which should be fine as a test server, remember this is a test server running under Windows as such it HAS NEVER BEEN INTENDED TO BE USED AS A PRODUCTION SERVER!
You may also change line 288:

display_startup_errors = Off
to
display_startup_errors = On

On line 351, you may possibly uncomment
“;arg_separator.output = “&amp;”

On line 378…

register_long_arrays = On
to
register_long_arrays = Off

After saving restart Apache. Run again your php5_info.php script and check that your changes are showing up as intended

Next: Let’s play with Extensions, there are a bunch of extensions that you will on your own explore however setting the SQL extension is a must!

Now, open your php.ini. On line 447 you should read: user_dir =”c:php” and below leave extension_dir = “./” as is.

Go to line 579 and uncomment:

extension=php_msql.dll
extension=php_mysql.dll

Save and give it a try
If it does not work try:

extension_dir = “C:PHPext”[fixed]

Save and try again!
As I mentioned all the DLLs should be in PHP dir or in the [fixed]PHP/ext dir.
If some are missing then unzip the PECL libraries zip file and pick your choices :)

Go to line 880 and enter

session.save_path = “C:Program FilesApache GroupApache2htdocstmp”

Do not forget to create the tmp dir.

From then you should have a working PHP

Install MySQL
Easy enough you may extract it in any dir that fits you. And run the setup.exe
Enjoy the show and follow the guide. (Chose to install at Apache Group root level)
Finished …MySQL is installed

You may or may not configure the root user (remember this is your test bed not a production server)
if you decide not to set a root user then do not use a password in your connection functions.

Create a shortcut to start MySQL: Go to Apache Group root and open the bin dir highlight mysqld.exe and create a shortcut – this will start MySQL,
do the same with MySQLshutdown and drag those shortcuts to your desktop
From then you may run a simple query test or wait and use the PHPmyAdmin as a final test

Install PHPmyAdmin

Extract the zip file to …. /apache group/apache2/htdocs
The PHPmyAdmin dir has a long name so we prefer renaming it as “pma”
Then go to pma/config.inc.php

On line 39, type:

$cfg[’PmaAbsoluteUri’ ] = ‘http://localhost/pma/’;

Go to line 84 and enter your password (again only if you set one!)

Verify that MySQL and Apache are running and go to http://localhost/pma/index.php

Looking for PHP, MySQL, AJAX Programmers : Contact Eway Business Solutions

Tags: web 2.0 Consulting & Services