Re: mysql_connect() error
Please use the [code] or [php] tags to post code.
It appears you have not enabled the php_mysql extension.
Re: mysql_connect() error
Hi
Thanks for the suggestion and sorry for not posting my code properly.
I've enabled this extension in config file
extension=php_mysql.dll
extension_dir = "C:/Program Files/PHP/ext/"
but I'm facing same problem I've tried both back slash and forward slash in my path but nothing worked at all.
my Apache and PHP are running MYSQL is also running I just cann't connect with MYSQL from PHP the error I receive is
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\helloSQL.php on line 6
Thanks & Regards
Manoj
Re: mysql_connect() error
yes, and just like penagate said -- you don't have the extension enabled. so, since you seem to be pointing at the right directory and have the line uncommented, here are some potential solutions:
first, make sure that your php.ini's path is correctly set in the apache configuration file. if it can't be found, php will still run -- but everything will be default. if you're unsure on how to do this, read "install.txt" in the PHP directory.
second, if the above doesn't work, look at apache's error log (default: 'apache/logs/error.log') when you start the web server and make sure that it is finding the extension in the first place. if the extension isn't being found, it will usually cause an error saying some extension couldn't be loaded, and usually includes the entire file path that it thinks the extension is in. if you can copy and paste that file path into windows explorer and get a prompt to download the DLL file, then you might have an issue with the fact that you're using "program files" as the root directory for PHP. as a general rule, and in my opinion, you should never install apache or php (or even mysql) in any directory that has a space in its name. make a new partition and install everything on that, or if that's too complex for you, just make a directory on your "C:" drive and install everything there. apache and php both seem to have issues with file paths with spaces (or at least they have had them in the past).
Re: mysql_connect() error
Hi,
I've done all this
I installed PHP in C:\PHP (without spaces in path)
nothing helped at all ................I'm still getting same error
I know PHP could not recognize mysql_connect() function
it may not getting dll path but I specified it
I wanted to know the possible cause for such errors.
even if I try to install php through installer and activate mysql it display a failure notice in installation. I don't know what's going wrong with it or me
bye
manoj
Re: mysql_connect() error
If you've installed PHP in C:\PHP then your extension_dir directive should be:
Code:
extension_dir = "C:\PHP\ext"
In future I recommend C:\php rather than C:\PHP but don't change it now that you've installed it.