Everyone help to see. I build php Apache MySQL environment on AWS.
Want to separate PHP Apache from MySQL.
Server A is only loaded with PHP and Apache. and the MySQL client
Server B only has MySQL installed.
The same code can execute successfully at the command line, and can query and insert data operations.
But there is an error under the webpage, prompt:
Can ' t connect to MySQL server on ' 192.168.9.9 ' (13)
The code is as follows:
\ n "; } ?>
Everyone help to see. The MySQL server version must be installed on server A.
Reply to discussion (solution)
is access restricted, and can only be accessed natively?
I am two servers, one is the database server, the other is the Php,apache server. It is only available at the command line on the Php,apache server. But it's not in the browser.
Can a machine ping the B machine?
and is the B machine allowed to connect remotely?
is MySQL extension on in phpinfo open properly?
is the root account remote permission open?
Assign the transport permission to a machine IP, for example:
GRANT select,insert,update,delete on *. * to root@ ' 172.16.16.152 ' identified by ' Youpassword ';
It's OK to use the PHP command line on a machine, the database is on the B machine, so it's not a remote or permissions issue.
Seems to have encountered similar problems before, and Apache-related, do not remember how to solve the.
Is there a problem with Apache Web page access to this script under Windows?
Thank you for your reply,
What does the Web access of Apache under Windows mean?
Because the code is the basic code, just loaded server test.
So I feel the code is OK, after all, the command line is no problem. PHP does not seem to have cross-platform issues.
Please see clearly above the 6 floor, I command line the following script is correct.
is MySQL extension on in phpinfo open properly?
The extension is normal. The phpinfo display is enabled.
Workaround 1: Setsebool-p httpd_can_network_connect_db=1
Workaround 2: Modify/etc/selinux/config selinux=enforcing to selinux=disabled
Workaround 1: Setsebool-p httpd_can_network_connect_db=1
Workaround 2: Modify/etc/selinux/config selinux=enforcing to selinux=disabled
Also try modifying my.cnf to add the client part:
[Client]
Port = 3306
Socket =/var/lib/mysql/mysql.sock
Workaround 1: Setsebool-p httpd_can_network_connect_db=1
Workaround 2: Modify/etc/selinux/config selinux=enforcing to selinux=disabled
Also try modifying my.cnf to add the client part:
[Client]
Port = 3306
Socket =/var/lib/mysql/mysql.sock
In addition to solution 1, the other two have tried. One is not, and the solution 2 modified, the machine does not come up ... Workaround 1 Yes: