How to Install and Configure Apache, PHP & MySQL
Install and Configure Apache, PHP & MySQL
Easy and Basic Installation and Configuration of Apache, PHP & MySQL .
Apache Download & Install
- Download Apache from the following site:
- Execute above file and Apache will be installed:
apache_2.2.2-win32-x86-no_ssl.msi
PHP Download & Install
- Download PHP from the following site:
- Create a directory D:\PHP (any drive you want) and extract the content of php-5.1.4-Win32.zip
Apache Configuration
- You have to make couple of little changes to the following file:
D:\Program Files\Apache Group\Apache2\conf\httpd.conf or where apache is install.
** To avoid accidental mistakes, I recommend you to save as:
httpd.conf > httpd.conf.save
- Default webroot directory is:
D:/Program Files/Apache Group/Apache2/htdocs
** If localhost or 127.0.0.1 is typed in the client browser, the content of index.html file of this directory will be delivered.
** It is not wise to work inside the Program Files directory. It is safer to create a directory somewhere else such as D:\WORK
- To make D:\WORK our default webroot directory we do the following changes:
# DocumentRoot “D:/Program Files/Apache Group/Apache2/htdocs” > disabled
DocumentRoot “D:/WORK” > added
# < Directory "D:/Program Files/Apache Group/Apache2/htdocs" > > disabled
< Directory "D:/WORK" > > added
*** Restart Apache
- Now we place our index.html file into D:\WORK
- Since we need to work with .php files, we introduce this extension to Apache as following:
AddType application/x-httpd-php .php
- If you want to parse .html files as PHP, just add the file extension to the list in your AddType line as following:
AddType application/x-httpd-php .php .html
When the client types localhost or 127.0.0.1 in the browser, the default page index.html is delivered. However, we need to work with PHP and therefore we change the default file to index.php as following:
# DirectoryIndex index.html index.html.var index.shtml > disabled
DirectoryIndex index.php > added
Finally we tell apache to load the PHP runtime library as following:
LoadModule php5_module D:/php/php5apache2.dll
** The above line assumes that PHP is installed on D:/PHP directory; if your installation is different, you should change it accordingly (For example C:/PHP)
PHP Configuration [ php.ini ]
- Rename D:\PHP\php.ini-dist
To D:\PHP\php.ini
- Change session.save_path = “N;/path”
To session.save_path = “D:/WORK”
- For Windows XP:
Copy D:\PHP\libmysql.dll
To WINDOWS\system32
extension_dir = “d:\php\ext”
- Enable
extension=php_mysql.dll
- Copy D:\PHP\php.ini
Into WINDOWS or WINNT folder
MySQL Download & Installation
- Download MySQL from the following site:
- Unzip mysql-noinstall-5.0.22-win32.zip and run setup.exe
It is recommanded that you install MySQL in C:\mysql
- If you install MySQL in a folder other than C:\MYSQL or you intend to start MySQL on NT or Win2000 as a service, you must create a file named C:\MY.CNF or \Windows\my.ini or \winnt\my.ini with the following
information::
[mysqld]
basedir=E:/installation-path/
datadir=E:/data-path/
- After your have installed MySQL, the installation directory will contain 4 files named
my-small.cnf
my-medium.cnf
my-large.cnf
my-huge.cnf
- You can use this as a starting point for your own C:\my.cnf file.
- To access MySQL from anywhere, add the following line to the autoexec.bat file:
PATH=C:\mysql\bin;
** Restart the machine
mysqld –install
NET START MYSQL
mysql –u root
- MySQL uses its own user permissions table. At setup, a default user (root) is automatically created with no password. It’s up to the database administrator to add other users with various permissions.
Comments are closed!