Okay, first and foremost I just want to say that I would appreciate any help possible on this topic and I am sorry if I annoy someone with my question. I have researched this topic and have done all that I can think of to get the "mysql_connect" function to work, however I still get a
"Fatal error: Call to undefined function mysql_connect()"
I have
1) edited my windows path to include (not using autoexex.bat btw) C:\PHP\
2) copied "libmySQL.dll" to my C:\PHP\ Directory
3) edited my main php.ini to enable the extension ";extension=php_mysql.dll" by omiting the ";" from the line.
If anyone could help me amend this problem, it would be most appreciated.
regards,
Brandon
urr the code.
<?php
$con = mysql_connect("localhost","lalala","lalala");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>It could be that you are possibly editing the wrong php.ini. Search your hard disk and make sure that there is not more than one, and if there is edit the other ones (one at a time, then restart your webserver and then check phpinfo()). PHP 5 i believe omes with mysql disabled so you could use mysqli. Just for the fun of it try this;
$con =mysqli_connect"'localhost", "username","password","databasename");using mysqli you connect to the server and the database at the same time in one statement saving an additional query.Thanks for your reply!
Okay after I edited the connect line I now get a parsing error.
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Also, I think I forgot to mention this (it was 4 in the morning) but when I edited my php.ini and enabled
extension=php_mysql.dll
I get an error stating:
PHP Startup: Unable to load dynamic library './php_mysql.dll' - the specified module could not be found."
probably important.
I checked my phpinfo() like you asked and it is not showing mysql.dll loaded int the additional modules section.
Thanks.
Brandonis your extension dir set in php.ini?
extension_dir = "where your php ext dir is ....."Oh I got it!
I just needed to find a copy of php_mysql.dll and put it in my C:\PHP\ director ALONG with my libmySQL.dll.
If anyone else has this problem and needs the dll (I had to download it) just contact me.
Thanks everyone for your input! I had no trouble finding php_mysql.dll in the .zip file I downloaded from php.net. It's in the ext/ directory along with the other extensions DLLs (which, incidentally, is a sensible place to have them, rather than in with php.exe itself. That's what the extension_dir setting in php.ini is for.) If it's been removed it's news to me.I read on various sources that their was an /etc directory, however I didnt see it. I even ran a search for the .dll. No luck.
I dont know if it is a new implementation or just me.it should be in the php directory it self. In my PHP folder there is an ext directory and also an extensions directory as well I guess because I have PHP 4 and PHP 5Of course, there's no guarantee if any of these files are present this if we're talking about some third-party PHP distribution, and not an official one from php.net.Hallo, I installed PHP 5.1.4, it works, but the php-win.exe crashes always (php.exe runs OK). When I restart Apache 2.0.54, it crashes twice and stops. Only without LoadModule MySQL restart Apache without problems (disabled in config). I used the original and also downloaded newest php_mysql.dll, without result. Can someone help me please? WinXP Home... Lubor.The problem with crash of php-win.exe is solved: I disabled Tidy extension in php.ini. May be a bug in PHP 5.1.4? L.Spamming Will Not Be Tolerated.
"Fatal error: Call to undefined function mysql_connect()"
I have
1) edited my windows path to include (not using autoexex.bat btw) C:\PHP\
2) copied "libmySQL.dll" to my C:\PHP\ Directory
3) edited my main php.ini to enable the extension ";extension=php_mysql.dll" by omiting the ";" from the line.
If anyone could help me amend this problem, it would be most appreciated.
regards,
Brandon
urr the code.
<?php
$con = mysql_connect("localhost","lalala","lalala");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>It could be that you are possibly editing the wrong php.ini. Search your hard disk and make sure that there is not more than one, and if there is edit the other ones (one at a time, then restart your webserver and then check phpinfo()). PHP 5 i believe omes with mysql disabled so you could use mysqli. Just for the fun of it try this;
$con =mysqli_connect"'localhost", "username","password","databasename");using mysqli you connect to the server and the database at the same time in one statement saving an additional query.Thanks for your reply!
Okay after I edited the connect line I now get a parsing error.
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Also, I think I forgot to mention this (it was 4 in the morning) but when I edited my php.ini and enabled
extension=php_mysql.dll
I get an error stating:
PHP Startup: Unable to load dynamic library './php_mysql.dll' - the specified module could not be found."
probably important.
I checked my phpinfo() like you asked and it is not showing mysql.dll loaded int the additional modules section.
Thanks.
Brandonis your extension dir set in php.ini?
extension_dir = "where your php ext dir is ....."Oh I got it!
I just needed to find a copy of php_mysql.dll and put it in my C:\PHP\ director ALONG with my libmySQL.dll.
If anyone else has this problem and needs the dll (I had to download it) just contact me.
Thanks everyone for your input! I had no trouble finding php_mysql.dll in the .zip file I downloaded from php.net. It's in the ext/ directory along with the other extensions DLLs (which, incidentally, is a sensible place to have them, rather than in with php.exe itself. That's what the extension_dir setting in php.ini is for.) If it's been removed it's news to me.I read on various sources that their was an /etc directory, however I didnt see it. I even ran a search for the .dll. No luck.
I dont know if it is a new implementation or just me.it should be in the php directory it self. In my PHP folder there is an ext directory and also an extensions directory as well I guess because I have PHP 4 and PHP 5Of course, there's no guarantee if any of these files are present this if we're talking about some third-party PHP distribution, and not an official one from php.net.Hallo, I installed PHP 5.1.4, it works, but the php-win.exe crashes always (php.exe runs OK). When I restart Apache 2.0.54, it crashes twice and stops. Only without LoadModule MySQL restart Apache without problems (disabled in config). I used the original and also downloaded newest php_mysql.dll, without result. Can someone help me please? WinXP Home... Lubor.The problem with crash of php-win.exe is solved: I disabled Tidy extension in php.ini. May be a bug in PHP 5.1.4? L.Spamming Will Not Be Tolerated.