Working on MySQL
Mysql>create database du;
Mysql>grant all on du.* to ' Benet ' @ ' 192.168.1.3 ' identified by ' 123 '
Mysql>flush privileges; Refresh Permissions
Working on the Web
[[email protected] ~]#/usr/local/nginx/sbin/nginx-v//See which modules have been compiled
[Email protected] ~]#/usr/local/php5/bin/php-i |grep Configure
Yun-y Install Mysql-devel
[[Email protected] ~]# CD Php-5.3.28/ext/mysql//Enter the extension path
[Email protected] mysql]#/usr/local/php5/bin/phpize
Configuring for:
PHP Api version:20090626
Zend Module Api no:20090626
Zend Extension Api no:220090626
Showing the above results proves your success. The Yum pack autoconf without success
Yum-y Install autoconf
[Email protected] mysql]#/configure--with-mysql--with-php-config=/usr/local/php5/bin/php-config
Compile this step will error ... Solution
[Email protected] mysql]# ln-s/usr/lib64/mysql/libmysqlclient.so.16/usr/lib/libmysqlclient.so
I can't find the/usr/lib/libmysqlclient.so extension module so I can connect this module to this directory
Make && make install build installation just fine.
[Email protected] mysql]# ls/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so//See if this directory has this module
[Email protected] mysql]# ls/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/mysql.so
/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/mysql.so////See if this directory has this module
[Email protected] mysql]# Vi/usr/local/php5/php.ini
946; Extension=msql.so
947 extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/mysql.so//Add Extension Module path in this directory
MySQL on view
[[Email protected] ~] #vi/etc/my.cnf
21 Rows
vi/var/www/benet/my.php
<?php
$link =mysql_connect (' 192.168.1.122:/tmp/mysql.sock ', ' du ', ' 123 ');
if ($link) echo "OK";
Mysqk_close ();
?>
[[email protected] mysql]# killall-s QUIT nginx
[Email protected] mysql]# Killall PHP-FPM
[Email protected] mysql]#/usr/local/nginx/sbin/nginx
[Email protected] mysql]#/USR/LOCAL/PHP5/SBIN/PHP-FPM
The above can be done to achieve the PHP connection mysq ......
This article from "Ah du" blog, declined reprint!
PHP connection MySQL Connection configuration