LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   PHP (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=19)
-   -   mysql in latest php build (http://www.litespeedtech.com/support/forum/showthread.php?t=5683)

stairmaster 02-07-2012 07:42 PM

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?

webizen 02-07-2012 08:33 PM

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:

/usr/local/lsws/fcgi-bin/lsphp5 -i | grep mysql
if no, you need to rebuild php with that option.

NiteWave 02-07-2012 08:35 PM

if php version is 5.3 or above, rebuild php by add --with-mysql=mysqlnd --with-mysqli=mysqlnd build parameter.

stairmaster 02-07-2012 08:42 PM

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);?>

stairmaster 02-07-2012 09:14 PM

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?

NiteWave 02-07-2012 09:21 PM

remove --with-mysql=/usr/bin --with-mysqli

stairmaster 02-07-2012 09:32 PM

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.

stairmaster 02-07-2012 09:33 PM

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.

webizen 02-08-2012 11:55 AM

Quote:

Originally Posted by stairmaster (Post 31817)
...
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.

Did you try what is suggested (reset mysql user password from mysql admin tool or take out old-password flag from my.cnf)?

if still does not work, try with different php compile option

Quote:

--with-mysql=/usr --with-pdo-mysql --with-libdir=lib64 --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-litespeed

stairmaster 02-08-2012 01:18 PM

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.