Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of 500th error in php connection to mysql

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to solve the problem of 500 errors in php connection mysql". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to solve the problem of 500 errors in php connection mysql".

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

How to solve the problem of php connection mysql 500error?

The mysql_connect () function is not available when PHP connects to mysql.

I didn't install the mysql extension when I was building the environment, but today I got an error when I was maintaining a project

Fatal error: Uncaught Error: Call to undefined function mysql_connect ()

You can use the phpize tool to manually compile and generate mysql.so extensions to solve the problem

Here are the steps:

1. Enter the ext/mysql directory of the php source code

Cd / home/oldboy/tools/php-5.5.32/ext/mysql/

two。 Run phpize and generate a configure file in this directory (php installation directory: / application/php/)

/ application/php/bin/phpize

3. Run configure, indicating the location of the php-config file (/ application/php/bin/php-config) and the mysql installation directory

. / configure-with-php-config=/application/php/bin/php-config-with-pdo-mysql=mysqlnd

4. Compile and install, generate mysql.so

Make & & make install

5. Modify php.ini file, add mysql.so extension configuration, save exit

Extension=mysql.so

6. Restart php-fpm

Service php-fpm restart

7. Test, add a php file, such as / usr/local/nginx/html/mysql.php, in the web directory

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report