PhpMysql with ISP-Server Setup - Ubuntu 5.10 "Breezy Badger"

Discussion in 'HOWTO-Related Questions' started by Yabadoo, Apr 1, 2006.

  1. Yabadoo

    Yabadoo Member

    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
    /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.
    Last edited: Apr 1, 2006
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Therea re two php.ini files. One for the mod_php and one for the cli php.


    locate php.ini

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

    Yabadoo Member

    I did locate php.ini, below the output.

    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 is uncommented.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Maybe your commandline php is php5 and not php4. Please check with the "-v" option which version number your cli php has.
  5. Yabadoo

    Yabadoo Member

    See below the output of php -v

    root@drbyte:# php -v
    PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20041030/' - /usr/lib/php5/20041030/ 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?
  6. till

    till Super Moderator Staff Member ISPConfig Developer


    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.
  7. Yabadoo

    Yabadoo Member

    root@drbyte:# which 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.
    Last edited: Apr 1, 2006
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    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
  9. Yabadoo

    Yabadoo Member

    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....:)
  10. falko

    falko Super Moderator Howtoforge Staff

    Don't remove it!

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

    Yabadoo Member

    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. !!!!
  12. Yabadoo

    Yabadoo Member

    Do i need to run the following command to fix the inconsistence of the alternatives database ?

    update-alternatives --config php
  13. falko

    falko Super Moderator Howtoforge Staff

  14. Yabadoo

    Yabadoo Member

    Thanks for the fast reply.
    I will update it, so everything is like it should be...:)

Share This Page