I. Problem reproduction 1. The webpage client uses jQuery technology to obtain data from the linux server. The webpage js Code is as follows: $. post (test. php); 2. the linux server uses the php Technology to access the mysql database. The code in test. php is as follows :? Php $ linkmysql_connect (localhost, root, 888888); if (! $ Link) {echoC
I. Problem reproduction 1. The webpage client uses jQuery technology to obtain data from the linux server. The webpage js Code is as follows: $. post (test. php); 2. the linux server uses the php Technology to access the mysql database. The code in test. php is as follows :? Php $ link = mysql_connect (localhost, root, 888888); if (! $ Link) {echo C
I. Problem Reproduction
1. The webpage client uses jQuery technology to obtain data from the linux server. The webpage js Code is as follows:
$.post("test.php");2. the linux server uses php Technology to access the mysql database. The code in test. php is as follows:
?
3. The result returned by the webpage client is "NetworkError: 500 Internal Server Error.
Ii. Problem Solution
1. if you encounter such a problem, first modify the test. php Code as follows:
?
This function returns all php-related information to the webpage client.
Through the test, I found that the php on this linux system did not have mysql items, and all the reasons were found. The next step is to complete the interaction between php and mysql.
You can directly install php to interact with mysql. The module name is "php-mysql". Use the linux Command yum install php-mysql.
The solution above is that linux on the server side can be used without the "yum" module. If the server side is castrated. How can I add the php-mysql module?
2. After installing php-mysql, compare the configuration in php with the system without installing php-mysql, and find that several files are added to the following directories.
(1) added the mysql. so and mysqli. so files in the/usr/lib/php/modules/directory. Copy the two files.
(2) the mysql. ini, mysqli. ini, and pdo_mysql.ini files are added to the/etc/php. d directory. Copy the three files.
As a result, you can access the data. The test is passed.
But there are other problems. With the post method, the server cannot obtain the data sent by the webpage client, but with the get method, the data sent by the client can be normally obtained.