Tuesday, August 7, 2007

Fedora as Web Server Using Apache, PHP and MySQL

This how-to will help you to install and configure apache, php and mysql under fedora.

This how-to will only show you how to enable those 3 programs. Further settings (such as hostname, mysql database, etc) will not being covered here.

OS used : Fedora Core 6
Apache : Apache 2.2.4
PHP : PHP 5.1.6
MySQL : MySQL 5.0.27

All the above can be installed by yum, but i highly recommended to install it from rpm files available to be downloaded at :

Fedora 6 RPMS

Notes :
Download ALL RPM files with this text in front of file name :
- httpd.....
- php....
- mysql....

put all downloaded files in one folder.
to install it, just issue :

rpm -ivh httpd*
rpm -ivh php*
rpm -ivh mysql*

after you have install all, you need to configure php so that it will be able to connect to mysql.

do the following :

vi /etc/php.ini

add the following line to php.ini under "Dynamic Extension" Section:

extension=mysql.so
extension-mysqli.so

make sure the extension directory under "Paths and Directories" is as follow :

extension_dir = "/usr/lib/php/modules"

Save php.ini file and issue the following command :

vi /etc/httpd/conf/httpd.conf

locate "LoadModule" section and find the following line :

#LoadModule php5_module /usr/lib/php/modules/libphp5.so

clear the hash mark (#) so that it will be :

LoadModule php5_module /usr/lib/php/modules/libphp5.so


Now configure apache (httpd) and mysql to run at startup. Type the following :

chkconfig httpd on
chkconfig mysqld on

reboot your computer ...

Your web server is ready ...