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

The method of error reporting when the mysql_connect function is not available

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following content mainly brings you the mysql_connect function is not available error handling methods, the knowledge here is slightly different from books, are professional and technical personnel in the process of contact with users, summed up, has a certain experience sharing value, hope to bring help to the majority of readers.

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

Copy the code

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

Database

Wechat

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

12
Report