PHP and MySQL separate connection mysql step and error troubleshooting

Source: Internet
Author: User
Tags fpm php and mysql zts

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

vi/var/www/benet/my.php
<?php
$link =mysql_connect (' 192.168.1.122 ', ' 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 and MySQL separate connection mysql step and error troubleshooting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.