The article explains installation of Apache HttpServer, PHP and MySQL on Windows XP without using XAMP, a requisite for installing Joomla 2.5x
The article will go through the following steps one by one:
- Software requirements for Joomla 2.5
- Install Apache 2.x and verify
- Install PHP and get PHP working
- Install MySQL
- Verify PHP to MySQL connectivity
Software requirements for Joomla 2.5
Below are the recommended versions for Joomla 2.5
PHP 5.2+
Apache 2.x+
MySQL 5.0.4+
Installing Apache 2.x and verify
Download Apache 2.x from http://httpd.apache.org/.
We are showing installation of HTTP Server 2.2.17.
Click the download installer file to start installation. Click through the initial screens.
Select the typical installation.
We generally prefer a simpler installation path like C:\Apache2.2\
Click and move ahead and click the "Install" button to start.
After the installation is complete, start the server and verify by accessing URL http://localhost.
The above screen would confirm successful installation of Apache HTTP Server.
Install PHP and get PHP working
Download PHP from http://windows.php.net/download/
Download the VC6 version. We use the PHP 5.2 version. Download the zip file from this site.
Unzip the downloaded file to a location like "C:\php".
The php initialization file needs to be configured. This file is present in C:\php by the name php.ini-recommended. It needs to be renamed as php.ini.
Some modification suggested for a local installation would be:
short_open_tag = On
display_errors = On
Modify the extensions directory to point to the correct location.
extension_dir = "c:/php/ext"
Modify the session save path to windows like path from /tmp. Below would be an example:
session.save_path = "c:\tmp"
Also, to get Apache HTTP Server to be aware about PHP, we need to enable PHP in httpd.conf file located at C:\Apache2.2\conf.
Uncomment the below line:
#LoadModule php5_module "c:/php/php5apache2_2.dll"
To
LoadModule php5_module "c:/php/php5apache2_2.dll"
Uncomment or add the following line, inside the <IfModule mime_module> section.
AddType application/x-httpd-php .php
Verify, if you see the file at the location using Windows Explorer. Do not use backslashes.
Also, add the PHP Ini directory as below in the httpd.conf. This needs to be added at the end of the file:
PHPIniDir "c:/php"
Restart Apache HTTP Server for the changes to take effect.
To verify PHP to be functional, create a simple test.php with the following content
<?php phpinfo(); ?>
Save this file to location C:\Apache2.2\htdocs. This is the default location in which the server will look
Verify accessing the URL, http://localhost/test.php.
A page as provided in the below screenshot should open:
If this does not work, also add php in the path.
Go to Control Panel --> System --> Advanced tab --> Environment variables, and in system variables, modify the path variable and add "C:\php" at the end.
Install MySQL
Download the MySQL community server from 5.5.11 from http://dev.mysql.com/downloads/mysql/.
Click on the downloaded installer to install MySQL.
Run through the initial screens and click on the Custom installation.
We recommend using the simple path like C:\MySQL\
Click the install button to start installation.
Move ahead to confirm the My SQL Server instance. Ensure to enable starting/stopping as service, which is a very handy feature.
Provide a root password and finish installation.
Verify PHP to MySQL connectivity
This could be one of a painstaking step in this process.
Ensure that you are able to access MySQL instance. Create a new schema as test and create a table test inside it.
Create the table with such a simple columns. Add some values into this table. We will be later writing a simple php file to pull data from this table and display to verify php to mysql connectivity.
However, before reaching this step, you might want to check http://localhost/test.php again. Scroll down and try to locate any section for MySQL. This will not be currently present and will have to be enabled.
We need to enable the php extension for mysql connectivity. You will have to again edit c:/php.ini file which we created earlier.
Look for the php_mysql.dll and uncomment it. Remove the leading ;
extension=php_mysql.dll
Restart apache HTTP Server and again verify http://localhost/test.php
Scroll down to locate a MySql section in this page as provided in the screenshot. This would mean that all PHP MySQL connectivity libraries are enabled, so that we can proceed with the testing of PHP and MySQL connectivity.
Create a new file in htdoc folder by the name mysql_conn_test.php and add the below code:
<?php
# Define MySQL Settings
define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PASS", "yourPass"); //Your root password goes in here
define("MYSQL_DB", "test");
$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());
$sql = "SELECT * FROM test";
$res = mysql_query($sql);
while ($field = mysql_fetch_array($res))
{
$id = $field['id'];
$name = $field['field'];
echo 'ID: ' . $field['id'] . '<br />';
echo 'Name: ' . $field['field'] . '<br /><br />';
}
?>
Now, try accessing http://localhost/ mysql_conn_test.php
If it fetches the content from database, it would mean that we are finally ready to start installation of Joomla 2.5