LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > mysql in latest php build

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2012, 07:42 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
Default 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?
Reply With Quote
  #2  
Old 02-07-2012, 08:33 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
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.
Reply With Quote
  #3  
Old 02-07-2012, 08:35 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
if php version is 5.3 or above, rebuild php by add --with-mysql=mysqlnd --with-mysqli=mysqlnd build parameter.
Reply With Quote
  #4  
Old 02-07-2012, 08:42 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
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);?>
Reply With Quote
  #5  
Old 02-07-2012, 09:14 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
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?
Reply With Quote
  #6  
Old 02-07-2012, 09:21 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
remove --with-mysql=/usr/bin --with-mysqli
Reply With Quote
  #7  
Old 02-07-2012, 09:32 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
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.
Reply With Quote
  #8  
Old 02-07-2012, 09:33 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
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.
Reply With Quote
  #9  
Old 02-08-2012, 11:55 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
Quote:
Originally Posted by stairmaster View Post
...
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
Reply With Quote
  #10  
Old 02-08-2012, 01:18 PM
stairmaster stairmaster is offline
Member
 
Join Date: Mar 2011
Posts: 22
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?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:15 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.