Forum Moderators: coopster

Message Too Old, No Replies

Problem With php call to mysql_connect

         

planit

12:20 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



I have a problem that I cant seem to find an answer for.
I have a Linux server and needed to upgrade PHP for a particular function. The PHP build told me to upgrade Apache. Anyway now I have Apache 2.0.52 running php 4.3.9. The phpinfo function works fine.

But when I try to run a mysql_connect command I get the response Page Not Found and ctrl-R only gives the last version of the page without the function in.

function_exists("mysql_connect") proves the function is there.

Since ther is no error message I cant get anywhere.
Please Help!

coopster

1:09 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, planit.

Have you turned error_reporting [php.net] on in your script so you can see the errors?

[edited by: coopster at 1:23 pm (utc) on Dec. 1, 2004]

planit

1:15 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



Yes I can even see the notices. I cant see any reason why I shouldnt get anything out.

coopster

1:27 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I guess the first step then would be to see if you are getting a connection or not and find out why...
$connect = mysql_connect('server', 'user', 'pwd') 
or exit('Could not connect (' . mysql_errno() . '): '
. mysql_error());
$db = mysql_select_db('database', $connect)
or exit('Could not select database (' . mysql_errno() . '): '
. mysql_error());

planit

1:34 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



as soon as the first line is included in the code it seems that the page is not even trying to load even with the 'or exit'

bcolflesh

2:03 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What about mysqli_connect() - does that work?:

[us2.php.net...]

planit

2:32 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



That Function is only available from php5

coopster

2:45 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sounds like a configuration issue. My suggestion at this point would be to go back through the PHP configuration file and double-check your entries, especially the MySQL Functions [php.net] configuration. Also check the phpinfo() information to make sure MySQL was compiled and operational.

planit

3:14 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



Here is the php info:
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.52
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.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

I cant see anything wrong but how would I find out if there was a problem.

Also I have tried the distribution php.ini and the same problem occurs

planit

4:46 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



After reinstalling MySQL and then reinstalling PHP I have solved the problem.
There Must Have Been a communication problem between PHP and MySQL

Thanks For All The Help

coopster

4:58 pm on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You're welcome. I figured it had to be a configuration issue. Sometimes a fresh installation is easiest ;)

Nice work.