PDA

View Full Version : PhpMysql with ISP-Server Setup - Ubuntu 5.10 "Breezy Badger"


Yabadoo
1st April 2006, 18:38
I followed the setup ISP-Server Setup - Ubuntu 5.10 "Breezy Badger",
The problem i have is that phpmysql is not running, when i do the command php-m, phpmysql is not in the list.
I didn't comment out de php things, because i don't setup ispconfig.
I tried the solutions mentioned below.

1. Reinstal php4-mysql by running:
apt-get install php4-mysql
root@drbyte:apt-get install php4-mysql
Reading package lists... Done
Building dependency tree... Done
php4-mysql is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

2. Uncommented the line in php.ine wich reads mysql.so
/etc/init.dapache2 restart, still no phpmysql running.

I also searched the internet for a week of 2 now, but still haven't found a solution for this. I found that there a lot of pepople who have also this problem.

When i run a php script in a terminal wich connects to a mysql database i get the following error.

Fatal error: Call to undefined function mysql_select_db() in /var/www/usnet/inc/optimize_database_2.php on line 8

I hope to find a solution with help from this forum.

till
1st April 2006, 21:17
Therea re two php.ini files. One for the mod_php and one for the cli php.

Run:

locate php.ini

to get the locations of both files and check if the mysql.so extension for php is enabled in both php.ini config files.

Yabadoo
1st April 2006, 21:24
I did locate php.ini, below the output.
/etc/php4/apache2/php.ini
/etc/php4/cli/php.ini
/etc/php5/cli/php.ini
/usr/share/doc/php4-common/examples/php.ini-dist
/usr/share/doc/php4-common/examples/php.ini-paranoid
/usr/share/doc/php4-common/examples/php.ini-recommended
/usr/share/doc/php5-common/examples/php.ini-dist
/usr/share/doc/php5-common/examples/php.ini-paranoid
/usr/share/doc/php5-common/examples/php.ini-recommended
/usr/share/php4/php.ini-dist
/usr/share/php5/php.ini-dist

I didn't install php5?, but i looked in both php.ini's, the one in
/etc/php4/apache and the one in /etc.php4/cli, in both file's mysql.so is uncommented.

till
1st April 2006, 21:31
Maybe your commandline php is php5 and not php4. Please check with the "-v" option which version number your cli php has.

Yabadoo
1st April 2006, 21:34
See below the output of php -v

root@drbyte:# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20041030/mysql.so' - /usr/lib/php5/20041030/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.0.5-2ubuntu1.2 (cli) (built: Mar 8 2006 08:18:34)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

So you are right how, i use php5, strange.
How can i go back to php4?

till
1st April 2006, 21:38
Execute:

which php

to get the location of the php command. Then check with (replace path with the path you got above):

ls -la /path/to/php

if the php command is a binary or a symlink to the php5 binary. If its a symlink, you can set a new symlink to your php4 binary.

Yabadoo
1st April 2006, 21:43
root@drbyte:# which php
/usr/bin/php

root@drbyte:# ls -la /usr/bin/php
lrwxrwxrwx 1 root root 21 2006-03-19 10:38 /usr/bin/php -> /etc/alternatives/php (cyan color)

root@drbyte:# ls -la /etc/alternatives/php
lrwxrwxrwx 1 root root 13 2006-03-25 16:36 /etc/alternatives/php -> /usr/bin/php5 (green color)

So the last line is where it goes wrong, but now i don't know how to correct this.

till
2nd April 2006, 18:30
Do you have a file /usr/bin/php4 ?

If so, remove /usr/bin/php and set a new symlink pointing from /usr/bin/php -> /usr/bin/php4

Yabadoo
2nd April 2006, 18:48
Yes there is a file php4 in /usr/bin.

1. What is the best way to remove the /usr/bin/php
rm /usr/bin/php

2. Is this the way to create a new symlink
ln -s /usr/bin/php4 ./usr/bin/php

3. What about the other link /etc/alternatives/php

I just want to know for sure before my server stops working....:)

falko
2nd April 2006, 23:29
Yes there is a file php4 in /usr/bin.

1. What is the best way to remove the /usr/bin/php
rm /usr/bin/phpDon't remove it!

Just run
rm -f /etc/alternatives/php
ln -s /usr/bin/php4 /etc/alternatives/php

Yabadoo
3rd April 2006, 20:15
This is great !!! :) :) :) :)
Everything is running fine now, i really appreciate this help.
Solved the problem in a few days, after searching the internet for 2,5 weeks.

Thanks again Till & Falko -> great job and support. !!!!

Yabadoo
5th April 2006, 20:33
Do i need to run the following command to fix the inconsistence of the alternatives database ?

update-alternatives --config php

falko
5th April 2006, 22:36
You can do so, but it's not necessary.
http://www.hants.lug.org.uk/cgi-bin/wiki.pl?LinuxHints/UpdateAlternatives

Yabadoo
5th April 2006, 23:09
Thanks for the fast reply.
I will update it, so everything is like it should be...:)