Call to undefined function mysql_connect

后端 未结 13 743
小蘑菇
小蘑菇 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:33

    My PC is running Windows 7 (Apache 2.2 & PHP 5.2.17 & MySQL 5.0.51a), the syntax in the file "httpd.conf" (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) was sensitive to slashes. You can check if "php.ini" is read from the right directory. Just type in your browser "localhost/index.php". The code of index.php is the following:

    <?php echo phpinfo(); ?>

    There is the row (not far from the top) called "Loaded Configuration File". So, if there is nothing added, then the problem could be that your "php.ini" is not read, even you uncommented (extension=php_mysql.dll and extension=php_mysqli.dll). So, in order to make it work I did the following step. I needed to change from

    PHPIniDir 'c:\PHP\'

    to

    PHPIniDir 'c:\PHP'

    Pay the attention that the last slash disturbed everything!

    Now the row "Loaded Configuration File" gets "C:\PHP\php.ini" after refreshing "localhost/index.php" (before I restarted Apache2.2) as well as mysql block is there. MySQL and PHP are working together!

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