1827892 Members
1857 Online
109969 Solutions
New Discussion

Fatal Error on MySql

 
Ng King Wang
Respected Contributor

Fatal Error on MySql

Hi all,

I use RedHat 8.0 as web server with PHP and MySql as below:
php-4.2.2-8.0.5
mysql-server-3.23.52-3

My colleague uploaded a lot of PHP files to the web server recently. When we tried to access our default web page, an error message is displayed as below:

Fatal error: Call to undefined function: mysql_connect() in /home/surathin/public_html/includes/functions/database.php on line 19

My colleague and I have no idea on this error. Any idea or solution on this error?

Thanks in advance.
We master OpenView, my Lord masters us.
10 REPLIES 10
Steven E. Protter
Exalted Contributor

Re: Fatal Error on MySql

Restore the dtabase.php file from backup.

Be more careful in the future.

If not an option, get the php file from another server.

Post the php file if its not to big. What's on line 18 or 19?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jerome Henry
Honored Contributor

Re: Fatal Error on MySql

Did you install php-mysql package, linking php to mysql ?
Get it here :
http://rpmseek.com/rpm-pl/php-mysql.html?hl=com&cs=php-mysql:PN:0:0:0

Check also that both are started, with service mysqld restart, service httpd restart.

J
You can lean only on what resists you...
Ng King Wang
Respected Contributor

Re: Fatal Error on MySql

Steven and Jerome, thank you for all your replies.

I tried to install "php-mysql-4.2.2-8.0.5.i386.rpm" as follows:

[root@es1 dng]# rpm -ivh php-mysql-4.2.2-8.0.5.i386.rpm
warning: php-mysql-4.2.2-8.0.5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60
e
Preparing... ########################################### [100%]
1:php-mysql ########################################### [100%]
[root@es1 dng]#

After rebooting the web server, i checked the module as below:

[root@es1 dng]# rpm -qa "php-mysql*"
php-mysql-4.2.2-8.0.5
[root@es1 dng]#

Then, I tried to access the default web page, the error message I posted before is disappeared. 2 new warning messages are displayed as below:

Warning: Access denied for user: 'surathin@localhost' (Using password: YES) in /home/surathin/public_html/includes/functions/database.php on line 19

Warning: MySQL Connection Failed: Access denied for user: 'surathin@localhost' (Using password: YES) in /home/surathin/public_html/includes/functions/database.php on line 19
Unable to connect to database server!

Attached file is "database.php". Any idea or solution? Please help.
We master OpenView, my Lord masters us.
Ng King Wang
Respected Contributor

Re: Fatal Error on MySql

Steven and Jerome, thank you for all your replies.

I tried to install "php-mysql-4.2.2-8.0.5.i386.rpm" as follows:

[root@es1 dng]# rpm -ivh php-mysql-4.2.2-8.0.5.i386.rpm
warning: php-mysql-4.2.2-8.0.5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60
e
Preparing... ########################################### [100%]
1:php-mysql ########################################### [100%]
[root@es1 dng]#

After rebooting the web server, i checked the module as below:

[root@es1 dng]# rpm -qa "php-mysql*"
php-mysql-4.2.2-8.0.5
[root@es1 dng]#

Then, I tried to access the default web page, the error message I posted before is disappeared. 2 new warning messages are displayed as below:

Warning: Access denied for user: 'surathin@localhost' (Using password: YES) in /home/surathin/public_html/includes/functions/database.php on line 19

Warning: MySQL Connection Failed: Access denied for user: 'surathin@localhost' (Using password: YES) in /home/surathin/public_html/includes/functions/database.php on line 19
Unable to connect to database server!

Attached file is "database.php". Any idea or solution? Please help.
We master OpenView, my Lord masters us.
Stuart Browne
Honored Contributor

Re: Fatal Error on MySql

It sounds as if the 'user' and 'db' tables in your 'mysql' database are a bit off.

Check the username/password that are listed in 'database.php', then check the tokens that are in the mysql table, and see if they match.

("select password('yourpaswd'), password from user where user = 'yourusername';, and make sure that the two match).

One long-haired git at your service...
Jerome Henry
Honored Contributor

Re: Fatal Error on MySql

And do not forget that passwords are encrypted in mysql Linux, so adding a new user would be '... values ('localhost', 'username', 'password(yourpass)', 'Y',...)
check this password(yourpassword) way of precising the password.
J
You can lean only on what resists you...
Ng King Wang
Respected Contributor

Re: Fatal Error on MySql

My colleague told me that he can run the PHP files and MySql on another server successfully.

My colleague and I believe that all problems are from our server. Once we solve all problems, I will let you all know the good news.



We master OpenView, my Lord masters us.
Balaji N
Honored Contributor

Re: Fatal Error on MySql

hi
is the database instance up and running and do u have correct access permissions.

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Ng King Wang
Respected Contributor

Re: Fatal Error on MySql

Hello all,

My colleague adjusted the user permission on MySql database. Warning message disappeared.

Thanks all.
We master OpenView, my Lord masters us.
Jerome Henry
Honored Contributor

Re: Fatal Error on MySql

Glad it worked !!
:]]

J
You can lean only on what resists you...