#1  
Old 9th June 2010, 15:03
Pashy Pashy is offline
Junior Member
 
Join Date: Jun 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
Sponsored Links
  #2  
Old 9th June 2010, 16:41
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

Your php installation doesn't have mysql support.

What linux distribution are you using? debian/fedora/centos?
Reply With Quote
  #3  
Old 9th June 2010, 17:07
Pashy Pashy is offline
Junior Member
 
Join Date: Jun 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default

I am using Fedora 11.
Mysql version - 5.1.46
PHP version - 5.2.13
Apache version - 2.2.15.
Reply With Quote
  #4  
Old 9th June 2010, 17:49
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

Code:
yum install php-mysql
restart apache and you're good to go
Reply With Quote
  #5  
Old 9th June 2010, 20:49
Pashy Pashy is offline
Junior Member
 
Join Date: Jun 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default PHP Fatal error

Dear Mark,

Thanks for your advice, but if your are pointing towards the installation
of the Drivers I had already done that during PHP installation, using the same
command that you have mentioned in your reply.

I am able to display the hello world & PHP info web page with their respective scripts.

I doubt I have to some changes in the PHP.ini file or httpd.conf file but nor sure what exactly I need to do.
I have also uncommented all the MySql lines in the PHP.ini file.

Kindly advice.
pashy
Reply With Quote
  #6  
Old 10th June 2010, 10:10
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

I would not change anything to the php.ini file, unless you know what you're doing.
The default settings are just fine to start learning php.

About your error

unknown function mysql_connect(); means that your php does not have mysql support .. installing the php-mysql package and then restart apache will resolve that issue.

try this:

create a file phpinfo.php and put this in it:
Code:
<?php phpinfo(); ?>
then open that file in your browser, you can see exactly what php supports at that moment. There should be a header called "Mysql"
Reply With Quote
  #7  
Old 10th June 2010, 10:27
Pashy Pashy is offline
Junior Member
 
Join Date: Jun 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thank you Mark,

Below is the info under header called "Mysql"

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 5.1.46
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off


Can we say the connection is successful?
Reply With Quote
  #8  
Old 10th June 2010, 13:07
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

Ok you have mysql support in php.. so if you have a file with something like:
Code:
<?php
error_reporting(E_ALL);
ini_set('display_erorrs', 1);
$foo = mysql_connect('localhost', 'user', 'pass');
?>
You get an error?
Reply With Quote
  #9  
Old 10th June 2010, 13:39
Pashy Pashy is offline
Junior Member
 
Join Date: Jun 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Smile

Dear Mark,
Thank you for all your time & kind support.
The info inserted in the PHP Webpage is reflected
in the DB table.

Thanks once again.

May be I would bother you again since this is just the beginning for me.

Cheer's
Reply With Quote
  #10  
Old 10th June 2010, 14:09
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
 
Default

Quote:
Originally Posted by Pashy View Post
May be I would bother you again since this is just the beginning for me.
uh oowww

np mate
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending mail ISPConfig 3 but not receivind catza Installation/Configuration 20 19th May 2010 13:47
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 18:26
ispconfig php 5 errors itamarjp Installation/Configuration 8 25th April 2008 11:20
network issues now it says "401 The web site is blocked by administrator" Check General 3 26th February 2008 15:22
Install stop at uuwish, UUDeview SeaWolf Installation/Configuration 6 5th October 2005 00:53


All times are GMT +2. The time now is 20:31.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.