seabro Posted September 25, 2009 Share Posted September 25, 2009 The following script was working on another server but stopped working when I moved to new server. The script returns Test 1 but not Test 2. It is dying at the line beginning $connect... I even commented out the Die() but that didn't help. Why won't it get past $connect? Assistance appreciated. <h1>Select Report Date</h1> <?php echo "test 1"; $connect = mysql_pconnect("localhost","user","pass"); // or Die("connect failed"); echo "test 2"; echo $connect; $selectdb = mysql_select_db("asterisk") or Die("select failed"); echo $selectdb; $query = "SELECT DISTINCT date_format(calldate,'%Y-%m-%d') as new_date from cdr ORDER BY new_date DESC LIMIT 50 "; echo $query; $connect; $selectdb; mysql_query($query) or die ("query x failed"); $res = mysql_query($query,$connect) or die("failed"); echo $res; print"<table align='center' border='1' cellspacing='0' cellpadding='5'>"; print "<tr>"; print "<td align='center'>"; print "Date"; print "</td>"; print "</tr>"; while($qry = mysql_fetch_array($res)) { $calldate=$qry["new_date"]; print "<tr>"; print "<td align='center'>"; print "<a href='incoming2.php?date="; print "$calldate'>"; print "$calldate"; print "</a>"; print "</td>"; }; ?> Quote Link to comment Share on other sites More sharing options...
ILMV Posted September 25, 2009 Share Posted September 25, 2009 What's the error? Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted September 25, 2009 Share Posted September 25, 2009 change this line... $connect = mysql_pconnect("localhost","user","pass"); to... $connect = mysql_pconnect("localhost","user","pass") or die(mysql_error()); and see what it says then. Quote Link to comment Share on other sites More sharing options...
seabro Posted September 25, 2009 Author Share Posted September 25, 2009 I did this and there is still no error at all. The only thing on my page is the text between the H1 tags and test 1. The script is stopping at $connect=......... For the record I have tried a echo phpinfo() and that works and I have logged into the mysql database from the command line using the dbasename, username and password from the script. I have also change the localhost to 127.0.0.1 but get same result. I am baffled.. any more ideas? Quote Link to comment Share on other sites More sharing options...
mayfair Posted September 25, 2009 Share Posted September 25, 2009 what happens if you change $connect = mysql_pconnect("localhost","user","pass") or die(mysql_error()); to $connect = mysql_connect("localhost","user","pass") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
seabro Posted September 25, 2009 Author Share Posted September 25, 2009 what happens if you change $connect = mysql_pconnect("localhost","user","pass") or die(mysql_error()); to $connect = mysql_connect("localhost","user","pass") or die(mysql_error()); No change / no error unfortunately. Quote Link to comment Share on other sites More sharing options...
Pickle Posted September 25, 2009 Share Posted September 25, 2009 don't add or die(mysql_error()); to the end of all mysql queries. Read this page: http://www.phpfreaks.com/blog/or-die-must-die Quote Link to comment Share on other sites More sharing options...
seabro Posted September 25, 2009 Author Share Posted September 25, 2009 any more ideas on this one people? I looked in /var/log/mysql - nothing relevant. is there a PHP log? Any more troubleshooting I can do? I appreciate your help. Quote Link to comment Share on other sites More sharing options...
seabro Posted September 25, 2009 Author Share Posted September 25, 2009 I tried from command line.. Does the following help troubleshoot or is it to be expected when execute from command line? [root@localhost ~]# php /var/www/html/stats/incoming.php Content-type: text/html X-Powered-By: PHP/4.3.9 <H1>Report Date</H1> PHP Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/stats/incoming.php on line 3 [root@localhost ~]# Quote Link to comment Share on other sites More sharing options...
Pickle Posted September 25, 2009 Share Posted September 25, 2009 hi have you tried $connect = @mysql_connect Quote Link to comment Share on other sites More sharing options...
seabro Posted September 25, 2009 Author Share Posted September 25, 2009 FIXED! Thanks for all your help. After I saw the error on the command line (that I wasn't seeing on my web page). I did some searching and one of the troubleshooting measures was Check if the php-mysql package is installed by opening a terminal window (bash), and typing, rpm -qa | grep php. If you don't see it, make a note of the exact version of PHP that is installed. I did this and I did not see php-mysql So I did yum install php-mysql, restarted apache and it all worked. sorry if I wasted anyones time I am a relative newbie. (I thought having PHP and MySQL installed was enough but there is obviously this php-mysql that glues them together). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.