Solve PHP Problem: Fatal Error: Call to undefined function: mysql

xiaoxiao2021-03-06  57

[Source] Recently, a new RHEL AS3 server has been installed; when installed, there is no choice to install the database (MySQL) related package. Since the mysql comes with RHELAE3 comes 3.23 version, I want to install it, when the Mount drive, the entire system will die without the remote login, so I simply install mysql4.1 directly. The problem may be thus thus. RHEL AS3 comes with Apache2 and php4.3.2. When I installed [MySql-Server-4.1.7-0.i386.rpm], when I tried to install the [Molyx] Forum, I found a fatal error when executing the database connection: Fatal Error: Call to undefined function: mysql_connect () This problem is really fatal. After HTTPD.CONF, PHP.INI and my.cnf, multi-part modification test, the problem is still. After the [Google] search, find a lot of related solutions. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- : This problem is summarized, that is, your PHP does not support mySQL_Connect () function. why? This is because PHP is a modular design, in addition to the core content, others are optional. The reason is not supported because there is no support to the MySQL database when compiling PHP. Speaking [2]: - If your operating system is Linux / UNIX 1. If the PHP is compiled by himself, then you have to do it. Adding to --with-mysql option 2. If you are using the RPM, it is recommended to find the RPM package that has built-in MySQL support, reloading it [3]: Because the previous mysql is unloaded The mysql is not all the paths after the installation of the RPM, but it needs ./Configure / --prefix = / usr / local / php / --with-mysql = / usr / local / mysql = / usr / local / mysql = / usr / local / mysql = / usr / local / mysql = / usr / local / mysql / (Mainly this sentence) used to specify the mysql installation path so after the path is different, Apache can't find the mysql installation path, Mysql_Connect: Unfained error ------------ -------------------------------------------------- -------- Headache is that the information from my phpinfo () is normal. I found a lot of PHP, MySQL-related lib / dbi / odbc and other packages on the RHEL CD. The problem is still not resolved. Later, I saw the DL ('mysql.so') in MySQL forum to dynamically load the module.

So I did a test PHP file: --------------------------------------- < ? # Test.phpecho "PHP Version ="; echo phpversion (); echo "
"; DL ('mysql.so'); Require "inc.php"; test (); echo "
"; DBConnect ();?> ---------------------------------------- ------------ ---------------------------- Results The error message is as follows: ----------------- ----------------------- PHP VERSION = 4.3.2Warning: DL (): unable to load dynamic library '/usr/lib/php4/mysql.so '- libmysqlclient.so.10: Cannot Open Shared Object File: No Such file or directory in /usr/www/test.php on line 9Function Test Output

Fatal error: Call to undefined function: mysql_connect () in line 7 --------------------------- ------------- The result is a clue: libmysqlclient.so.10. It turned out that this module was not loaded successfully. Then I in the system Find, I found that there is no such file at all. It should be something else. -------------------------------------------- # rpm -ivh / home /dkk/libdbi-dbd-mysql-0.6.5-5.i386.rpm error: failed dependencies: libdbi = 0.6.5-5 is needed by libdbi-dbd-mysql-0.6.5-5 libmysqlclient.so.10 IS Needed by libdbi-dbd-mysql-0.6.5-5 suggested resolutions: libdbi-0.6.5-5.i386.23.58-1.i386.rpm ------------ -------------------------------- In MySQL.com, the search libmysqlclient.so, finally found the problem of the problem: mysql4 Call the libmysqlclient.so, call libmysqlclient.so, is not the same as mysql3.23, and php4.3.2 and apache are called in the old way, so I can't find libmysqlclient.so. English is as follows: ------------------------------------------- Ensure That you do not have any MySQL clients that use shared libraries (like the Perl DBD :: mysql module). If you do, you should recompile them, because the data structures used in `libmysqlclient.so 'have changed. The same applies to other MYSQL Interfaces As Well, Such as the python mysqldb module. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----- Specific description see posts: http://dev.mysql.com/doc/mysql/en/upgrading-from-3.23.html problem found, but I don't want to recompile PHP, although 5.0 has come out .

There are some rpm there in mysql.com, I put them all, specifically: # rpm -ivh mysql-client-4.1.7-0.i386.rpm # rpm -ivh mysql-debvol-4.1.7-0. i386.rpm # rpm -ivh mysql-shared-4.1.7-0.i386.rpm # rpm -ivh mysql-shared-compat-4.1.7-0.i386.rpm I think the most important thing is the last package (- Shared-compat-), because mysql.com indicates that the package contains a 3.23 module; and I am installed in the above package (restart mysql and apache) test that Test.php until the last one is installed until the last one is installed until the last one is installed until the last one is installed. In order to find a new "successful" error: Warning: function registration failed - duplicate name - mysql_connect in /usr/www/test.php on line 9 嘿, this error, is explaining the system has been successful Loaded mysql.so, which triggered the error when Test.php DL ('mysql.so') tried to be loaded. It is finally laughing here. Remove the DL ('mysql.so') in Test.php and retest. Hey, a "old mistake" ran out: warning: mysql_connect (): Client Does Not Support Authentication Protocol Requested by Server; Consider Upgrading MySQL Client In /uSR/www/inc.php on line 7 huh, I have known it for a long time La. Only because the password encryption method of MySQL4 changes. Log in to the mysql execution statement with root: Update user set password = Old_password ('password') where user = 'root'; Specific description See the following posts: http: //dev.mysql.com/doc/mysql/en/old_client.html to this, the finals can be successfully resolved. Hey, it is really cost, main reason is that you don't know much about things throughout the system. If you have a better solution, please add it. :-)

转载请注明原文地址:https://www.9cbs.com/read-85073.html

New Post(0)