PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Hello, OpenSUSE Leap 15.4 PHP 8.0.10, I needed to upgrade to PHP 8 becuase on my wordpress sites I needed php 7.2.30 or greater. PHP 7.4.25 is was installed. In my /etc/php7/apache2/php.ini files I had extension=mysqli extension=pdo_mysql All my wordpress sites worked and phpinfo displayed mysqli Sadly after upgrading to PHP 8 It isn't found. Pastebin will not allow the contents of In my https://www.zenez.com/cgi-bin/phpinfo.php Pastebin’s SMART filters have detected potentially offensive or questionable content in your Paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters, because of this you’re receiving this warning. This Paste can only be published with the visibility set to "Private". I have in my /etc/php8/apache2/php.ini extension=mysqli extension=pdo_mysql Just as before but in the php7 directory. My system has /usr/lib64/php8/extensions/mysqli.so But all my wordpress sites which haven't changed are getting this erro. PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in ... Obvioulsy, my system isn't loading the extiontion. Note one my apache2handler php8 isn't found, but in /etc/sysconfig/apache2, I have APACHE_MODULES="suexec authz_host actions alias auth_basic authn_file authz_groupfile authz_user autoindex cgi dir env include log_config mime negotiation setenvif status userdir asis cache headers imagemap logio proxy proxy_http rewrite ssl perl wsgi-python3 itidy socache_shmcb wsgi wordpress proxy_wstunnel authn_core version authz_core mailman reqtimeout php8-fpm apache2-mod_php proxy_fcgi php php8" PHP Additional files parsed does have /etc/php8/conf.d/mysqli.ini which has ; comment out next line to disable mysqli extension in php extension=mysqli.so So it should be loaded. Any ideas on how to resolve the issue? Thanks in advance. Regards, -- Boyd Gerber <gerberb@zenez.com> 801 849-0213 ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
Hello, will top post here. PHP 8 doesn't have function mysql_connect() you need to convert your code to mysqli_connect() Google is your friend https://www.google.com/search?client=firefox-b-d&q=php8+call+to+undefined+function+mysql_connect%28%29 Greeting Becki Am 20.11.2022 um 10:10 schrieb Boyd Lynn Gerber:
Hello,
OpenSUSE Leap 15.4 PHP 8.0.10, I needed to upgrade to PHP 8 becuase on my wordpress sites I needed php 7.2.30 or greater. PHP 7.4.25 is was installed. In my /etc/php7/apache2/php.ini files I had
extension=mysqli extension=pdo_mysql
All my wordpress sites worked and phpinfo displayed mysqli Sadly after upgrading to PHP 8 It isn't found.
Pastebin will not allow the contents of
In my https://www.zenez.com/cgi-bin/phpinfo.php
Pastebin’s SMART filters have detected potentially offensive or questionable content in your Paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters, because of this you’re receiving this warning. This Paste can only be published with the visibility set to "Private".
I have in my
/etc/php8/apache2/php.ini
extension=mysqli extension=pdo_mysql
Just as before but in the php7 directory. My system has
/usr/lib64/php8/extensions/mysqli.so
But all my wordpress sites which haven't changed are getting this erro.
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in ...
Obvioulsy, my system isn't loading the extiontion. Note one my apache2handler php8 isn't found, but in /etc/sysconfig/apache2, I have
APACHE_MODULES="suexec authz_host actions alias auth_basic authn_file authz_groupfile authz_user autoindex cgi dir env include log_config mime negotiation setenvif status userdir asis cache headers imagemap logio proxy proxy_http rewrite ssl perl wsgi-python3 itidy socache_shmcb wsgi wordpress proxy_wstunnel authn_core version authz_core mailman reqtimeout php8-fpm apache2-mod_php proxy_fcgi php php8"
PHP Additional files parsed does have
/etc/php8/conf.d/mysqli.ini
which has
; comment out next line to disable mysqli extension in php extension=mysqli.so
So it should be loaded.
Any ideas on how to resolve the issue?
Thanks in advance.
Regards,
Hello, Thanks, Admin Beckspaced <admin@beckspaced.com> It is True it doesn't why adding the below is required. In /etc/php7/apache2/php.ini the below 2 lines are required for PHP 7 and above. extension=mysqli extension=pdo_mysql Now with the updated PHP $ php -version PHP 8.0.10 (cli) (built: Feb 22 2022 12:00:00) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.10, Copyright (c) Zend Technologies with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies So I just tried adding them to /etc/php8/cli/php.ini $ php -version PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php8/extensions/mysqli (/usr/lib64/php8/extensions/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php8/extensions/mysqli.so (/usr/lib64/php8/extensions/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib64/php8/extensions/pdo_mysql (/usr/lib64/php8/extensions/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib64/php8/extensions/pdo_mysql.so (/usr/lib64/php8/extensions/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0 $ l /usr/lib64/php8/extensions/mysqli.so -rwxr-xr-x 1 root root 138352 May 7 2022 /usr/lib64/php8/extensions/mysqli.so PHP 8 updated and now shared libraries are not being loaded. All wordpress sites worked and phpinfo displayed mysqli Sadly after upgrading to PHP 8 php.ini. It fails. On Sunday 2022-11-20 10:54, Admin Beckspaced wrote:
PHP 8 doesn't have function mysql_connect() you need to convert your code to mysqli_connect()
Google is your friend
Thanks, I wish google assisted but, Sadly it doesn't. I opened a case with wordpress community when things failed with PHP 7. Updateing PHP 7 removed the line. the /etc/php7/apache2/php.ini file was deleted and the file used on the update was missing the line extension=mysqli https://wordpress.org/support/topic/linux-leap-15-4uncaught-error-call-to-un... Sadly the same solution doesn't work. mysqli isn't found.
Wordpress tries to use mysqli_connect() and falls back to the old funstion. And prints it as the message in the error log. I am using mysqli_connect() It is the mysqli extenstion above in the PHP 8 /etc/php8/apache2/php.ini It has to be there for both PHP 7 and PHP 8. What I just learned when adding the variable to the CLI php.ini file the dynamic libraries are not being loaded. I'm not sure if the same applies to the apache2/php.ini failing. I now have to investigate this Regards, -- Boyd Gerber <gerberb@zenez.com> 801 849-0213 ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
On 20.11.2022 17:13, Boyd Lynn Gerber wrote:
Hello,
Thanks, Admin Beckspaced <admin@beckspaced.com> It is True it doesn't why adding the below is required.
In /etc/php7/apache2/php.ini the below 2 lines are required for PHP 7 and above.
extension=mysqli extension=pdo_mysql
Now with the updated PHP
$ php -version PHP 8.0.10 (cli) (built: Feb 22 2022 12:00:00) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.10, Copyright (c) Zend Technologies with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies
So I just tried adding them to /etc/php8/cli/php.ini
$ php -version PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php8/extensions/mysqli (/usr/lib64/php8/extensions/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php8/extensions/mysqli.so (/usr/lib64/php8/extensions/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
It rather clearly says that it cannot load extension because some other required library is missing. You may want to google for "undefined symbol: mysqlnd_global_stats".
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib64/php8/extensions/pdo_mysql (/usr/lib64/php8/extensions/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib64/php8/extensions/pdo_mysql.so (/usr/lib64/php8/extensions/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
$ l /usr/lib64/php8/extensions/mysqli.so -rwxr-xr-x 1 root root 138352 May 7 2022 /usr/lib64/php8/extensions/mysqli.so
PHP 8 updated and now shared libraries are not being loaded.
All wordpress sites worked and phpinfo displayed mysqli Sadly after upgrading to PHP 8 php.ini. It fails.
On Sunday 2022-11-20 10:54, Admin Beckspaced wrote:
PHP 8 doesn't have function mysql_connect() you need to convert your code to mysqli_connect()
Google is your friend
Thanks, I wish google assisted but, Sadly it doesn't. I opened a case with wordpress community when things failed with PHP 7. Updateing PHP 7 removed the line.
the /etc/php7/apache2/php.ini file was deleted and the file used on the update was missing the line
extension=mysqli
https://wordpress.org/support/topic/linux-leap-15-4uncaught-error-call-to-un...
Sadly the same solution doesn't work. mysqli isn't found.
Wordpress tries to use mysqli_connect() and falls back to the old funstion. And prints it as the message in the error log.
I am using mysqli_connect() It is the mysqli extenstion above in the PHP 8 /etc/php8/apache2/php.ini It has to be there for both PHP 7 and PHP 8.
What I just learned when adding the variable to the CLI php.ini file the dynamic libraries are not being loaded. I'm not sure if the same applies to the apache2/php.ini failing. I now have to investigate this
Regards,
On Sunday 2022-11-20 17:34, Andrei Borzenkov wrote:
On 20.11.2022 17:13, Boyd Lynn Gerber wrote:
Hello,
Thanks, Admin Beckspaced <admin@beckspaced.com> It is True it doesn't why adding the below is required.
In /etc/php7/apache2/php.ini the below 2 lines are required for PHP 7 and above.
extension=mysqli extension=pdo_mysql
Now with the updated PHP
$ php -version PHP 8.0.10 (cli) (built: Feb 22 2022 12:00:00) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.10, Copyright (c) Zend Technologies with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies
So I just tried adding them to /etc/php8/cli/php.ini
$ php -version PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/php8/extensions/mysqli (/usr/lib64/php8/extensions/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/php8/extensions/mysqli.so (/usr/lib64/php8/extensions/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
It rather clearly says that it cannot load extension because some other required library is missing. You may want to google for "undefined symbol: mysqlnd_global_stats".
The library is there, but can be resolved by loading module /mysqlmysqli (the only difference) after module mysqlnd. PHP apears to load alphabetically resulting in the error -- Boyd Gerber <gerberb@zenez.com> 801 849-0213 ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
Hello all To resolve the issue add in this order to /etc/php8/apache2/php.ini extension=mysqlnd extension=mysqli extension=pdo_mysql Thanks, -- Boyd Gerber <gerberb@zenez.com> 801 849-0213 ZENEZ 1042 East Fort Union #135, Midvale Utah 84047
On 11/20/22 03:10, Boyd Lynn Gerber wrote:
In my https://www.zenez.com/cgi-bin/phpinfo.php
Pastebin’s SMART filters have detected potentially offensive or questionable content in your Paste. The content you are trying to publish has been deemed potentially offensive or questionable by our filters, because of this you’re receiving this warning. This Paste can only be published with the visibility set to "Private".
Side note on issue: I have had problems with this in the past attempting to paste config files that the poor paste.opensuse.com logic has refused to paste claiming the contents were a virus (I wrote it up here and also sent it to admin), guess the smarts of the paste site still aren't. -- David C. Rankin, J.D.,P.E.
participants (5)
-
Admin Beckspaced
-
Andrei Borzenkov
-
Boyd Lynn Gerber
-
David C. Rankin
-
Philip van der Matten