php and mysqli
Hi there,
Â* the following code fails on my fedora 17 box: Â* <?php Â* mysqli_init(); Â* ?> Â* PHP Fatal error:Â* Call to undefined function mysqli_init() in /home/gbuday/public_html/init.php on line 3 Â* doing a grep around php –i, Â*/etc/php.ini and /etc/php.d/ I get a seemingly ok configuration, see below. My versions of php and mysql are Â* $ php --version PHP 5.4.6 (cli) (built: Aug 20 2012 11:30:18) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies $ mysql --version mysqlÂ* Ver 14.14 Distrib 5.5.27, for Linux (i686) using readline 5.1 Â* What other files I should look for the problem? How can I make mysqli work? Â* I have the following php and mysql packages installed: Â* $ rpm -qa|egrep '(mysql|php)' php-process-5.4.6-2.fc17.i686 php-5.4.6-2.fc17.i686 mysql-5.5.27-1.fc17.i686 mysql-server-5.5.27-1.fc17.i686 php-cli-5.4.6-2.fc17.i686 php-xml-5.4.6-2.fc17.i686 php-ZendFramework-Db-Adapter-Mysqli-1.11.12-1.fc17.noarch php-common-5.4.6-2.fc17.i686 php-mysql-5.4.6-2.fc17.i686 php-ZendFramework-1.11.12-1.fc17.noarch php-devel-5.4.6-2.fc17.i686 mysql-libs-5.5.27-1.fc17.i686 php-pdo-5.4.6-2.fc17.i686 php-bcmath-5.4.6-2.fc17.i686 Â* - Gergely Â* php –i: Â* '--with-mysqli=shared,mysqlnd' in configuration Â* mysqli Â* MysqlI Support => enabled Client API library version => 5.5.27 Active Persistent Links => 0 Inactive Persistent Links => 0 Active Links => 0 Client API header version => 5.5.27 MYSQLI_SOCKET => /var/lib/mysql/mysql.sock Â* Directive => Local Value => Master Value mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => no value => no value mysqli.default_user => no value => no value mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off Â* /etc/php.ini : Â* ; Maximum number of persistent links.Â* -1 means no limit. ; http://php.net/mysqli.max-persistent mysqli.max_persistent = -1 Â* ; Allow accessing, from PHP's perspective, local files with LOAD DATA statements ; http://php.net/mysqli.allow_local_infile mysqli.allow_local_infile = On Â* ; Allow or prevent persistent links. ; http://php.net/mysqli.allow-persistent mysqli.allow_persistent = On Â* ; Maximum number of links.Â* -1 means no limit. ; http://php.net/mysqli.max-links mysqli.max_links = -1 Â* ; If mysqlnd is used: Number of cache slots for the internal result set cache ; http://php.net/mysqli.cache_size mysqli.cache_size = 2000 Â* ; Default port number for mysqli_connect().Â* If unset, mysqli_connect() will use ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the ; compile-time value defined MYSQL_PORT (in that order).Â* Win32 will only look ; at MYSQL_PORT. ; http://php.net/mysqli.default-port mysqli.default_port = 3306 Â* ; Default socket name for local MySQL connects.Â* If empty, uses the built-in ; MySQL defaults. ; http://php.net/mysqli.default-socket mysqli.default_socket = Â* ; Default host for mysql_connect() (doesn't apply in safe mode). ; http://php.net/mysqli.default-host mysqli.default_host = Â* ; Default user for mysql_connect() (doesn't apply in safe mode). ; http://php.net/mysqli.default-user mysqli.default_user = Â* ; Default password for mysqli_connect() (doesn't apply in safe mode). ; Note that this is generally a *bad* idea to store passwords in this file. ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") ; and reveal this password!Â* And of course, any users with read access to this ; file will be able to reveal the password as well. ; http://php.net/mysqli.default-pw mysqli.default_pw = Â* ; Allow or prevent reconnect mysqli.reconnect = Off Â* Â* /etc/php.d $ cat mysql.ini ; Enable mysql extension module extension=mysql.so Â* -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
php and mysqli
2012-09-28 14:28, Buday Gergely skrev:
Hi there, the following code fails on my fedora 17 box: <?php mysqli_init(); ?> I think you should read the manual (if you have not done that already). Look at the following page, specially the example given there: http://php.net/manual/en/mysqli.real-connect.php PHP Fatal error: Call to undefined function mysqli_init() in /home/gbuday/public_html/init.php on line 3 doing a grep around php –i, /etc/php.ini and /etc/php.d/ I get a seemingly ok configuration, see below. My versions of php and mysql are $ php --version PHP 5.4.6 (cli) (built: Aug 20 2012 11:30:18) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies $ mysql --version mysql Ver 14.14 Distrib 5.5.27, for Linux (i686) using readline 5.1 What other files I should look for the problem? How can I make mysqli work? I have the following php and mysql packages installed: $ rpm -qa|egrep '(mysql|php)' php-process-5.4.6-2.fc17.i686 php-5.4.6-2.fc17.i686 mysql-5.5.27-1.fc17.i686 mysql-server-5.5.27-1.fc17.i686 php-cli-5.4.6-2.fc17.i686 php-xml-5.4.6-2.fc17.i686 php-ZendFramework-Db-Adapter-Mysqli-1.11.12-1.fc17.noarch php-common-5.4.6-2.fc17.i686 php-mysql-5.4.6-2.fc17.i686 php-ZendFramework-1.11.12-1.fc17.noarch php-devel-5.4.6-2.fc17.i686 mysql-libs-5.5.27-1.fc17.i686 php-pdo-5.4.6-2.fc17.i686 php-bcmath-5.4.6-2.fc17.i686 - Gergely php –i: '--with-mysqli=shared,mysqlnd' in configuration mysqli MysqlI Support => enabled Client API library version => 5.5.27 Active Persistent Links => 0 Inactive Persistent Links => 0 Active Links => 0 Client API header version => 5.5.27 MYSQLI_SOCKET => /var/lib/mysql/mysql.sock Directive => Local Value => Master Value mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => no value => no value mysqli.default_user => no value => no value mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off /etc/php.ini : ; Maximum number of persistent links. -1 means no limit. ; http://php.net/mysqli.max-persistent mysqli.max_persistent = -1 ; Allow accessing, from PHP's perspective, local files with LOAD DATA statements ; http://php.net/mysqli.allow_local_infile mysqli.allow_local_infile = On ; Allow or prevent persistent links. ; http://php.net/mysqli.allow-persistent mysqli.allow_persistent = On ; Maximum number of links. -1 means no limit. ; http://php.net/mysqli.max-links mysqli.max_links = -1 ; If mysqlnd is used: Number of cache slots for the internal result set cache ; http://php.net/mysqli.cache_size mysqli.cache_size = 2000 ; Default port number for mysqli_connect(). If unset, mysqli_connect() will use ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look ; at MYSQL_PORT. ; http://php.net/mysqli.default-port mysqli.default_port = 3306 ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. ; http://php.net/mysqli.default-socket mysqli.default_socket = ; Default host for mysql_connect() (doesn't apply in safe mode). ; http://php.net/mysqli.default-host mysqli.default_host = ; Default user for mysql_connect() (doesn't apply in safe mode). ; http://php.net/mysqli.default-user mysqli.default_user = ; Default password for mysqli_connect() (doesn't apply in safe mode). ; Note that this is generally a *bad* idea to store passwords in this file. ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") ; and reveal this password! And of course, any users with read access to this ; file will be able to reveal the password as well. ; http://php.net/mysqli.default-pw mysqli.default_pw = ; Allow or prevent reconnect mysqli.reconnect = Off /etc/php.d $ cat mysql.ini ; Enable mysql extension module extension=mysql.so -- Regards Jon Ingason -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
php and mysqli
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On Fri, 28 Sep 2012, Buday Gergely wrote: > PHP Fatal error: Call to undefined function mysqli_init() in > /home/gbuday/public_html/init.php on line 3 # grep mysqli_init /usr/lib64/php/modules/mysqli.so Binary file /usr/lib64/php/modules/mysqli.so matches # cat /etc/php.d/mysqli.ini ; Enable mysqli extension module extension=mysqli.so So, - - check if file /usr/lib/php/modules/mysqli.so exist (you use a 32-bit Fedora so /lib64/ is /lib/ in your case). - - check if file /etc/php.d/mysqli.ini exist and has the content listed above. - - check if files from php-mysql rpm package are not corrupted (rpm -vV php-mysql) Or, you may try to re-install php-mysql (yum reinstall php-mysql). Then, restart the web-server. It should work. Sincerely, Gabriel - -- // Gabriel VLASIU // // OpenGPG-KeyID : 44952F15 // OpenGPG-Fingerprint: 4AC5 7C26 2FE9 02DA 4906 24B2 D32B 7ED7 4495 2F15 // OpenGPG-URL : http://www.vlasiu.net/public.key -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJQZd0rAAoJENMrftdElS8VDZ0P/RmzlsQYCWF5V3Ip8BOtPWOb uFp+lP6LZVLlJflHm48rvXmujmeq40L5eGj0yDGBt3bTHfQr5d K/PEarkvdzvLG5 OaG4xQDiLwOxmUnu52XBfLSDEwTAFVRwYYpT1s0+bXA0uoYxES Nfb7VJASYk7dZ4 LfiynM1W5i4kF+Agp8Kqj1thB+L8K+p/boBIOLTnFpqws2bvp3djROHLCX064u4+ PdRbiwwe7ftEmwld328Y3cQEpZeMN44dejD64YM+MpO101Qfiz Kt0pkO1dhaHMzp TbkBnrQhlucpVpnEzQ8LAzlw9h2IrRYpyrai+fOdXAQj+Q8Heq ezTX9LdyTpkjPB uYSwkF2ye+/E+VT33kckoUB0M3VTCAjVhOIVov/GGY5eRlYNWgwedRF6onzYif+e Ew7iNSn5GGJ9evKecNAn1YTrlbnkjevKLU05yA8oskfAQEiPi3 BN1uT8luQVrRa1 bJtCiDhVlXqGTKtpkXGToVZsJgi7GNK1DExFTqvDq2nMmP5Oa/6OM/ObvTjchqH3 F5XgdFFUCO8yAVskxQpbZk+EuzyMQUuJB4PL9UVZJc7DVcehVa NLn+O4Mg2tPDQb IobguqjMz2uiRZR9ku05zWJqO96cyaJRA86+kA9T37EvSkRmLh hJjvQysinI+CCF 9MLULA7G1TVRuAzv3x6l =gBAh -----END PGP SIGNATURE----- -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
php and mysqli
>> PHP Fatal error: Call to undefined function mysqli_init() in
>> /home/gbuday/public_html/init.php on line 3 Thanks for all the explanations. It was something of shooting one's foot: mysqld_safe was running and it was quite likely to be the source of the error. Starting regular mysqld solved the problem. - Gergely -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
| All times are GMT. The time now is 12:16 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.