![]() |
mysql in latest php build
Our web pages use mysql not mysqli and it seems that after re-installing php, the mysql module doesn't exist anymore.
So our database connections are broken. How can I get mysql working again? |
likely you left out the '--with-mysql' option when you re-compile php. to verify, do following from command line and see anything comes up:
Quote:
|
if php version is 5.3 or above, rebuild php by add --with-mysql=mysqlnd --with-mysqli=mysqlnd build parameter.
|
I put this in
--with-mysql=/usr/bin --with-libdir=lib64 --with-mysqli --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-litespeed I read that would help .. and it did allow php to compile. I restarted the server, but the mysql connections still don't work. I also have a problem with php includes .. if they are using the full path, they don't work. Eg this doesn't work <?php $a = file_get_contents("http://". $_SERVER['HTTP_HOST'] . "/xxx.htm"); echo ($a);?> But this works <?php $a = file_get_contents("xxx.htm"); echo ($a);?> |
I've done what you've suggested with adding --with-mysql=mysqlnd --with-mysqli=mysqlnd
and I added --with-mysql as well. So the options are currently --with-mysql=/usr/bin --with-libdir=lib64 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysqli --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-litespeed My includes work properly now. But my database connections still don't work. Anything else I can try? |
remove --with-mysql=/usr/bin --with-mysqli
|
I took those out and so had this
--with-libdir=lib64 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-litespeed But then after restarting litespeed it didn't help. |
Here are the error messages I get when trying to connect to mysql ..
Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:553) in /home/xxx/public_html/xxx.php on line 113 Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in /home/xxx/public_html/xxx.php on line 113 Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in /home/xxx/public_html/xxx.php on line 113 Cannot connect to the database. |
Quote:
if still does not work, try with different php compile option Quote:
|
Yes I did reset the password so it was 41 instead of 16 and I also commented out the old-password flag in my.cnf
This didn't help so I went back to an older version of php. I was still having a problem I mentioned a couple posts back with the php command 'file_get_contents' .. if it is using the full path, it doesn't work. Eg this doesn't work <?php $a = file_get_contents("http://". $_SERVER['HTTP_HOST'] . "/xxx.htm"); echo ($a);?> But this works <?php $a = file_get_contents("xxx.htm"); echo ($a);?> So I have rebuilt the entire server from a backup. But after about 5 minutes of working correctly, the problem occurs. It returns an error message sometimes, not all the time - Warning: file_get_contents() [function.file-get-contents]: Failure when receiving data from the peer in /home/aaa/public_html/servervars.php on line 20 What can I do? |
| All times are GMT -7. The time now is 10:20 AM. |