A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearProblems with php-cli and mysql, why is mysql_pconnect() not available? - page 1
User InfoPosts
Problems with php-cli and mysql, why is mysql_pconnect() not available?#1
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!

posted date: 2009-04-08 00:41:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-08 00:41:01


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#3
Does it say it list the MySQL modules when you execute phpinfo();?

posted date: 2009-04-08 00:42:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#4
php -i | grep mysqlThe first line should contain:Configure Command => (../configure( ... (--with-mysql=shared,/usr(Also check grep extension_dir /etc/php5/cli/php.iniShould be something like: extension_dir = /usr/lib/php5/extensionsThen check permissions of /usr/lib/php5/extensions/mysql.so and if it(s properly linked:ldd /usr/lib/php5/extensions/mysql.so

posted date: 2009-04-08 00:50:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#5
@bart I've updated my question with some more info

posted date: 2009-04-08 00:51:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#6
Can you please do: php -v php -r 'var_dump(extension_loaded("mysql"));'

posted date: 2009-04-08 00:57:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#7
A newline missing after "php -v", of course.

posted date: 2009-04-08 00:58:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#8
Does pconnect in cli mode make sense? maybe this is "working as intended".Note: Note, that these kind of links only work if you are using a module version of PHP. See the Persistent Database Connections section for more information.http://de2.php.net/mysql_pconnect

posted date: 2009-04-08 01:04:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#9
@jaka Updated with your suggestion. var_dump returns nothing. txn.

posted date: 2009-04-08 01:06:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#10
mysql_connect doesn't work either. And i would think mysql_pconnect should work, but idd it does not make sense, i'm using the sphyder search engine cli scripts. and i'm using it exactly like docs tell me.

posted date: 2009-04-08 01:08:00


Re: Problems with php-cli and mysql, why is mysql_pconnect() not available?#11
You cant use pconnect in CLI mode. You dont have a persistent process like the web server which can hold the open connection.

posted date: 2012-05-18 02:25:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.