Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-03 15:32:06 11月14日 Update

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

Tags: Errors directories problems files generation content environment learning compiling running practical deeper location interest function practical practical tool manual easy to operate Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information MariaDB NVidia Docker