Ubuntu PHP5, MySQL, Apache2 installation order..

January 22nd, 2007 by ltz

Installing the Ubuntu Server distribution and perhaps only using the php5-cli module (= php interpreted at the command line..) together with MySQL works fine. However if you want apache2 installed later on, the installation might result in an errormessage not very unlike:

Call to undefined function mysql_pconnect() …..
This is because of php not finding the mysql addon. The installation order in ubuntu messed ut the automatic configuration and the config file will not be able to find the correct mysql.so file. This is of course given that you have installed all the required modules correctly (php5, php5-mysql, apache2, mysql ….+ libs).

Try this for a solution..

Update the database..
sudo slocate -u

Find the mysql.so file.
locate mysql.so

Probably returns /usr/lib/php5/20051025/mysql.so, create and copy this file to a extensions directory to the php5.
sudo mkdir /usr/lib/php5/ext
sudo cp /usr/lib/php5/20051025/mysql.so /usr/lib/php5/ext/

Last, edit the php.ini file.
sudo pico /etc/php5/apache2/php.ini

Look for a mysql.so entry. (Search in pico by using ctrl+w). It should look like:
extension = mysql.so
Save the php.ini file. (ctrl+x then enter y)
Restart the apache2 webbserver:
sudo apache2ctl restart
This should do it..

Edit:
Link: ubuntu forum guide surrounding the same problem.

Posted in *NIX, Comp |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Pierre Norraeus
Joomla! 1.5 Beta 2 - Red Barchetta