Call to undefined function mysql_connect

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

    Check your php.ini, I'm using Apache2.2 + php 5.3. and I had the same problem and after modify the php.ini in order to set the libraries directory of PHP, it worked correctly. The problem is the default extension_dir configuration value.

    The default (and WRONG) value for my work enviroment is

    ; extension_dir="ext"
    

    without any full path and commented with a semicolon.

    There are two solution that worked fine for me.

    1.- Including this line at php.ini file

    extension_dir="X:/[PathToYourPHPDirectory]/ext
    

    Where X: is your drive letter instalation (normally C: or D: )

    2.- You can try to simply uncomment, deleting semicolon. Include the next line at php.ini file

    extension_dir="ext"
    

    Both ways worked fine for me but choose yours. Don't forget restart Apache before try again.

    I hope this help you.

提交回复
热议问题