NetworkError: 500 Intern occurs when the Web client accesses mysql data using php.

Source: Internet
Author: User
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.

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.