Results 1 to 9 of 9
Hi friends,
I am a newbie.
I am trying to connect PHP with Mysql, but
coming across the below error:
PHP Fatal error: Call to undefined function mysql_connect() in /var/www/html/index.php ...
- 06-09-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 10
PHP Fatal error
Hi friends,
I am a newbie.
I am trying to connect PHP with Mysql, but
coming across the below error:
PHP Fatal error: Call to undefined function mysql_connect() in /var/www/html/index.php on line 2
Can anyone suggest with the possbile solution, with easily
undestandable explanation...
Thanks in advance..
pashy
- 06-09-2010 #2
Could you post the contents of index.php file here?
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 06-09-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
Most likely mysql is not enabled on your php installation. Create a dummy HTML page on your web server with the php code from below and call it through the web browser. It will tell you if mysql is enabled.
- 06-09-2010 #4
Do you have the php-mysql package installed? You need that.
- 06-10-2010 #5Just Joined!
- Join Date
- Apr 2010
- Posts
- 10
Hi Folks,
Thanks for all your replies.
I have fixed the problem & the connection is sucessful.
Just sharing this exp in case any one faces the problem in future.
The php-mysql package was missing.
After installing it & uncommenting some mysql lines in the php.ini file.
I was able to echo the function in the php web page but had a new error in the error logs file:
connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
as you guys can see number 13 in the error
#perror 13
OS error code 13: Permission denied
It was an OS error about permissions.
Eventually after :
#chmod 777 /var/lib/mysql
Everything worked fine, atleast as of now..
Cheer's
- 06-10-2010 #6Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
755 would be better than 777
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.
- 06-10-2010 #7Just Joined!
- Join Date
- Apr 2010
- Posts
- 10
Sorry what do you mean by "PM"?
- 06-10-2010 #8Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
PM - Private Message
You don't really want your /var/lib/mysql directory to be world writeable!RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.
- 06-11-2010 #9Just Joined!
- Join Date
- Apr 2010
- Posts
- 10
ohh..! I see, thanks.


Reply With Quote