[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 913
  • Last Modified:

Fatal error loading MailWatch

Hi,

I have set up Mailscanner on a remote server running Redhat Linux Enterprise ES3.  Now I am trying to set up MailWatch.  At this point Mailscanner is logging to mysql successfully and when I do  http://myhost/phpinfo.php I can get all the php info to show.

The error I get when trying http://myhost/mailscanner is "Fatal error: Call to undefined function: mysql_escape_string() in /var/www/html/mailscanner/functions.php on line 528"

Thanks,
mwclassen
0
mwclassen
Asked:
mwclassen
  • 11
  • 9
1 Solution
 
cjl7Commented:
Hi,

You are probably running a php version below 4.0.3...

mysql_escape_string() is supported =>4.0.3...

//jonas
0
 
mwclassenAuthor Commented:
This is what returns from a command line.  

[root@argosy root]# php -v
PHP 4.4.2 (cgi) (built: Apr  6 2006 09:52:10)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

I set up an index.php test (phpinfo() ) to run from a browser, and it returns PHP 4.3.2.  Now, I'm not sure what I have:)

0
 
cjl7Commented:
OK,

Found this...

4.3.0       This function became deprecated, do not use this function. Instead, use mysql_real_escape_string().

So try to change mysql_escape_string() to mysql_real_escape_string() instead...

//jonas
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
mwclassenAuthor Commented:
Maybe I'm not clear as to the suggestion.

When I change the function call to mysql_real_escape_string in /var/www/html/mailscanner/functions.php on line 528 I just get another Fatal Error with that name.  To me, it looks like php isn't able to see mysql functions.

mwclassen
0
 
cjl7Commented:
Well,

You probably has on more then one occation.

perl -i.orig -pe 's/mysql_escape_string/mysql_real_escape_string/g' *.php

would change all occations and save a file called <filename>.orig for you...

Post the errors you get.

//jonas
0
 
mwclassenAuthor Commented:
[root@argosy php-4.4.2]# perl -i.orig -pe 's/mysql_escape_string/mysql_real_escape_string/g' *.php
[root@argosy php-4.4.2]#

It created two files 'run-tests.php.orig' and 'server-tests.php.orig'  without error.

mwclassen
0
 
cjl7Commented:
Does you program run now?

//jonas
0
 
mwclassenAuthor Commented:
No. I still get the same error.

If I go down the list of php files in the same directory I'll get partial screen loads with different messages.  They all have to do with mysql which makes me think that something is still keeping php and mysql from getting along.

When I installed php I used the ./configure --with-mysql without a path and it seemed to run fine without errors.  I'm not sure that it was actually pointed at the right libraries.  Then, again, obviously I don't know what I'm doing:)

mwclassen
0
 
cjl7Commented:
Have you got php-mysql installed?

Does this show the version of php-mysql? (it should)
rpm -qa php-mysql

if not install php-mysql and try again...

//jonas
0
 
cjl7Commented:
Hmm,

Didn't see that you installed php from commandline... (compiled your own...)

save this as mysql.php and run it from the command line...

<?php
$user="root";
$password="";
$database="";
mysql_connect("localhost",$user,$password);
//@mysql_select_db($database) or die( "Unable to select database");
$query="show databases;";
$result = mysql_query($query);
mysql_close();

echo mysql_result($result, 0, 0) . "\n";
?>

You need to change the user and password...

It should give you something back, if you get errors post it here...

//jonas
0
 
mwclassenAuthor Commented:
[root@argosy /]# php /var/www/html/mysqltest.php
X-Powered-By: PHP/4.4.2
Content-type: text/html

<br />
<b>Warning</b>:  mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in <b>/var/www/html/mysqltest.php</b> on line <b>5</b><br />
information_schema

mwclassen
0
 
cjl7Commented:
You probably have a newer mysqlclient installed but not at the default location!

(or in your path)

Put your new one (the one you compiled) before the old one in your path...

Or if you can un-install Red Hat's original mysql applications if you are not using them...

//jonas
0
 
mwclassenAuthor Commented:
jonas,

I'm getting in this over my head:)  

I can see this discussion going on with a solution obscured by the mess we have obviously made of our server!  I am willing to award the points since this discussion as led to several issues we need to resolve.

Let me know..

mwclassen
0
 
cjl7Commented:
Don't worry!

It's not as bad as you think...

The problem is that you are using two versions of mysql (one for the server part and another for the client part)

Suggestion #1:
Remove all mysql stuff, install the Red Hat versions (up2date mysql-server mysql) and try again...

Suggestion #2:
remove all Red Hat mysql stuff and try again... (should only be mysql and mysql-client)

//jonas
0
 
mwclassenAuthor Commented:
Thanks, jonas!

I chose Suggestion #1 and up2date appeared to work just fine.  I am able to look at tables like before.

Now, I am trying to do the same thing with php to resolve the two versions that were appearing.  I'm having a little difficulty finding a download for Redhat Linux Enterprise 3.

mwclassen
0
 
cjl7Commented:
Hi,

up2date php-mysql php

Should get you sorted.

//jonas
0
 
mwclassenAuthor Commented:
Mysql was working fine last evening.  I run the up2date php-mysql php which did sort things out, and I can get phpinfo to show from a browser so I know php is working.

Now when I try to start mysql, it fails, and this error shows in the logfile.

060517 11:14:20  mysqld started
060517 11:14:20  /usr/libexec/mysqld: Incorrect information in file: './mysql/host.frm'
060517 11:14:20  mysqld ended

It seems like we're so close!

mwclassen
0
 
cjl7Commented:
No problems...

You have a newer database in your /var/lib/mysql...

cd /var/lib/mysql
mv mysql mysql.old
service mysqld start

Should get you started!

//jonas
0
 
mwclassenAuthor Commented:
Yesssssssssssssssssss!!!!!!!!!!!!!  jonas, you the man!!!!  I have been trying to get MailWatch for Mailscanner setup for a least a month, and now it works:))))))))

I am accepting the post with the suggestions to clean up mysql and start over because that seemed to be were my problem originated.

Thanks for all your time and patience, jonas!

mwclassen

0
 
cjl7Commented:
Your welcome.

//jonas
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 11
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now