Call to undefined function mysql_connect

后端 未结 13 741
小蘑菇
小蘑菇 2020-12-03 11:06

I just installed PHP and Apache on my home PC. When I try to call function mysql_connect I get:

fatal error: call to undefined function mysql_co         


        
相关标签:
13条回答
  • 2020-12-03 11:07

    Be sure you edited php.ini in /php folder, I lost all day to detect error and finally I found I edited php.ini in wrong location.

    0 讨论(0)
  • 2020-12-03 11:09

    After change our php.ini, make sure to restart Apache web server.

    0 讨论(0)
  • 2020-12-03 11:09

    One time I had a problem while using Off instead of off. And also check the pads one more time... The path has to be exact. Also add the following line to your environmental variable.

    C:\your-apache-path\bin; C:\your-php-path\bin;C:\your-mysql-path\bin
    

    If you are in Windows, right click My Computer, select properties, and navigate to the Advanced tab... (is Windows 7). Click on Advanced system settings first then select the Advanced tab and then Environmental variables. Select PATH and click on Edit. Make a copy of the string in a .txt file for back up (it might be empty)--- set your environmental variables... Log out and log back in.

    0 讨论(0)
  • 2020-12-03 11:11

    Since mysql_connect This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. by default xampp does not load it automatically

    in your php.ini file you should uncomment

    ;; extension=php_mysql.dll
    

    to

    extension=php_mysql.dll
    

    Then restart your apache you should be fine

    0 讨论(0)
  • 2020-12-03 11:11

    I think that you should use mysqli_connect instead of mysql_connect

    0 讨论(0)
  • 2020-12-03 11:22

    You have probably forgotten to restart apache/wamp/xamp/whatever webserver you use, you need to do that in order to make it work

    0 讨论(0)
提交回复
热议问题