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

Go Back   LiteSpeed Support Forums > External Applications > PHP > [Solved] Call to undefined function mysql_connect() error

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2011, 03:02 PM
dougconran dougconran is offline
Member
 
Join Date: Jan 2010
Posts: 15
Default [Solved] Call to undefined function mysql_connect() error

I need to be able to run Wordpress and, for that, I need PHP.

I've compiled PHP using the 'Compile PHP' option under 'Actions' and then manually built PHP (with --with-mysqli).

I then ran 'sudo -u nobody ./lsphp5 -i' and have confirmed that mysqli is present.

I've run phpinfo in a web browser which shows a whole lot of info about Mysql and which indicates that PHP itself is working.

However, when I try and connect to an existing Mysql database I get the following error message:-

Fatal error: Call to undefined function mysql_connect() in /usr/local/httpd/htdocs/phptest.php on line 10

How can I resolve this as I need PHP with Mysql for Wordpress?

TIA

Doug

PS - I'm on SuSE Linux 11.3 and Litespeed v4.0.18
Reply With Quote
  #2  
Old 03-13-2011, 03:50 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
you need '--with-mysql' option
Reply With Quote
  #3  
Old 03-14-2011, 02:13 AM
dougconran dougconran is offline
Member
 
Join Date: Jan 2010
Posts: 15
Thank you for a very quick reply.

The build file already had '--with-mysqli' as a configure parameter. I did try adding '--with-mysql' immediately before '--with-mysqli' to the initial configure statement however, on re-building, it appeared to ignore mysql in favour of mysqli.

Should I REPLACE '--with-mysqli' with '--with-mysql' or do I need to do something different?

Rgds

Doug
Reply With Quote
  #4  
Old 03-14-2011, 02:22 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
you can try '--with-mysql=/usr --with-mysqli' or '--with-mysql=/usr' (without mysqli). Essentially option '--with-mysql' is needed for mysql_* functions (e.g. mysql_connect()). You may use mysqli_* function in your php script if --with-mysql does not work for you.
Reply With Quote
  #5  
Old 03-15-2011, 02:04 AM
dougconran dougconran is offline
Member
 
Join Date: Jan 2010
Posts: 15
Default Solved - Call to undefined function mysql_connect() error

Problem solved!

In fact your first answer fixed the problem but when I first tried it I had managed to add the --with-mysql to the comment rather than the configure statement (It was late at night).

Anyway all is working perfectly now - again, many thanks for such good and swift help.

Rgds

Doug
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 03:25 AM.



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