Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with php-cli and mysql, why is mysql_pconnect() not available?
    primarykey
    data
    text
    <p>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:</p> <pre><code>Fatal error: Call to undefined function mysql_pconnect() </code></pre> <p>I have tried starting from scratch by removing all depending packages and configuration like this:</p> <pre><code>sudo apt-get --purge remove php5 libapache2-mod-php5 php5-cli php5-mysql </code></pre> <p>Then I've run following command to install the packages:</p> <pre><code>sudo apt-get install php5 libapache2-mod-php5 php5-cli php5-mysql </code></pre> <p>Then I've found out which php.ini the cli uses like that:</p> <pre><code>php -r "phpinfo();" | grep php.ini </code></pre> <p>Which gives me this:</p> <pre><code>Configuration File (php.ini) Path =&gt; /etc/php5/cli/php.ini </code></pre> <p>Then i've uncommented 'mysql.so' in the extensions section but when i do and run following command it says:</p> <pre><code>PHP Warning: Module 'mysql' already loaded in Unknown on line 0 </code></pre> <p>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.</p> <p>I know there's a sections to enable persistent connections, it on by default and the standard function 'mysql_connect' is also not available.</p> <p>What am I missing? Thanks!</p> <p>UPDATE:</p> <p>As suggested by Bart S. 'php -r "phpinfo();" | grep mysql':</p> <blockquote> <pre><code>MYSQL_SOCKET =&gt; /var/run/mysqld/mysqld.sock MYSQL_INCLUDE =&gt; -I/usr/include/mysql MYSQL_LIBS =&gt; -L/usr/lib -lmysqlclient mysql.allow_persistent =&gt; On =&gt; On ... and more </code></pre> </blockquote> <p>From Jaka Jančar. 'php -v' shows:</p> <blockquote> <p>PHP 5.1.2 (cli) (built: Feb 11 2009 19:55:22)</p> </blockquote> <p>And from php interactive mode 'php -r 'var_dump(extension_loaded("mysql"));' gives nothing!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload