Monday, May 29, 2006

Installing and Configuring Apache2+PHP+MySQL

My PC runs on Ubuntu. And just thought of configuring Apache2+PHP+MySQL

How do i do that?

https://wiki.ubuntu.com/ was really useful on this account.

Just typed PHP on the search window and it populated few results that took me to,

https://wiki.ubuntu.com/ApacheMySQLPHP?highlight=%28php%29

Installing Apache:

As root user run,

# aptitude install apache2

Installing PHP:

As root user run, and i preferred PHP4,

# aptitude install php4

Now its the turn for mySQL,

# aptitude install mysql-server
# aptitude install libapache2-mod-auth-mysql
# aptitude install php4-mysql


For want of GUI admin for mySQL and PHP admin did the following,

# aptitude install phpmyadmin

# aptitude install mysql-admin


Then follows the mySQL configuration which am yet to do and jumped to "PHP Configuration to Work With MYSQL"

To achieve this,

# gedit /etc/php4/apache2/php.ini

and remove the ";" before the line ";extension=mysql.so"

Commands used for Apache Start/ Stop/ Restart,

# /usr/sbin/apache2ctl start
# /usr/sbin/apache2ctl stop
# /usr/sbin/apache2ctl restart


To check PHP's fine funtioning,

# gedit /var/www/testphp.php

and add php phpinfo(); inside php tag and Save.

On mozilla browser, at http://127.0.0.1/testphp.php or http://localhost/testphp.php, I got the successful output.

This was working fine till i rebooted my PC.

Apache is not actually parsing the php after i rebooted my PC.

I believe port 80 used default by Apache was occupied and hence the problem.

# netstat -nap --inet|grep -w 80|grep -i listen

used the above command to plot which process is occupying port 80 and killed the process and restarted Apache and it started working fyn :-)

In order to fix this,

# gedit /etc/apache2/ports.conf

and changed "Listen 80" to "Listen 127.0.0.1:81"

This will also prevent it from listening for incoming connection attempts.

Now rebooting was not a problem and

http://127.0.0.1:81/ is running without parsing problems.

To be contd....

1 Comments:

Anonymous Anonymous said...

Hallo I absolutely adore your site. You have beautiful graphics I have ever seen.
»

4:17 AM  

Post a Comment

<< Home