I've installed various PHP packages to be able to use PHP with Apache but also in the commandline. From both I need to be able to connect to MySQL databases. Pretty simple right? That's what I thought but with php-cli I receive following error:
Fatal error: Call to undefined function mysql_pconnect()
I have tried starting from scratch by removing all depending packages and configuration like this:
sudo apt-get --purge remove php5 libapache2-mod-php5 php5-cli php5-mysql
Then I've run following command to install the packages:
sudo apt-get install php5 libapache2-mod-php5 php5-cli php5-mysql
Then I've found out which php.ini the cli uses like that:
php -r "phpinfo();" | grep php.ini
Which gives me this:
Configuration File (php.ini) Path => /etc/php5/cli/php.ini
Then i've uncommented 'mysql.so' in the extensions section but when i do and run following command it says:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0
So for some reason he thinks it is already loaded, but with or without the 'mysql.so' enabled the php cli does not find the 'mysql_pconnect' function.
I know there's a sections to enable persistent connections, it on by default and the standard function 'mysql_connect' is also not available.
What am I missing? Thanks!
UPDATE:
As suggested by Bart S. 'php -r "phpinfo();" | grep mysql':
MYSQL_SOCKET => /var/run/mysqld/mysqld.sock MYSQL_INCLUDE => -I/usr/include/mysql MYSQL_LIBS => -L/usr/lib -lmysqlclient mysql.allow_persistent => On => On ... and more
From Jaka Jančar. 'php -v' shows:
PHP 5.1.2 (cli) (built: Feb 11 2009 19:55:22)
And from php interactive mode 'php -r 'var_dump(extension_loaded("mysql"));' gives nothing!