php and mysqli

Jon Ingason jon.ingason at telia.com
Fri Sep 28 14:03:54 UTC 2012


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



More information about the users mailing list