Hello everyone,
I noticed a very strange behaviour of PHP-FPM 5.4. PHP seems to "forget"
about the MySQL extension after one request or so. I am not sure, but I
think this is a bug in PHP.
Steps to reproduce:
Take a clean Ubuntu Server 12.04 64-Bit install (all updates), prepare
everything for the installation of PHP:
apt-get install build-essential apache2-mpm-worker apache2-mod-fastcgi
libxml2-dev mysql-server && apt-get build-dep php
Download PHP 5.4.13 and use the following configure line:
./configure --enable-fpm --with-mysql=shared --with-mysqli=shared
Compile and install PHP, configure PHP-FPM and Apaches mod_fastcgi,
create a simple script:
-----------------------------------------------------
<?php
$db = mysql_connect('localhost', 'root', 'root');
if (!$db) {
echo 'Failed connecting to db!';
exit;
}
$res = mysql_query('SHOW DATABASES');
if (!$res) {
echo 'Failed getting data!';
exit;
}
while ($row = mysql_fetch_assoc($res)) {
echo '<pre>';
var_dump($row);
echo '</pre><hr/>';
}
-----------------------------------------------------
And start all services. phpinfo() says that MySQL extension is loaded.
The first one or two requests will be all right (i.e. all databases will
be displayed), but when you reload the page a few times the following
error will appear:
Fatal error: Call to undefined function mysql_connect() in
/var/www/test.php on line 2
All subsequent requests will trigger this error, until you restart PHP-FPM.
The interesting thing is that phpinfo() still says that the MySQL
extension was loaded, even though the script complains about missing
mysql_connect(). It is also interesting that the statistics of mysqlnd
in phpinfo() state that active_connections has a value of
18446744073709551615, which seems a little high.
Can anyone reproduce this problem or does anyone know how to solve this?
Thanks for your help
Nico
[Index of Archives]
[PHP Users]
[PHP Home]
[PHP on Windows]
[Kernel Newbies]
[PHP Classes]
[Postgresql]
[PHP Books]
[PHP Databases]
[PHP SOAP]