LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2004, 03:42 PM   #1
d2army
Member
 
Registered: Jun 2004
Posts: 49

Rep: Reputation: 15
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20


Hi there

I have both PHP 4.0( RPM) installed and MySQL 4.0.20 installed with the mysqld daemon up and running. But when I look at the output of phpinfo() , I do not see it there, which is worrisome and so I tried to recompile PHP and do ./configure with the --with-mysql=path but I don't really know where my mysql's header files should be , is there any way to find that out by using any of the mysql commands?

I did try to do ./configure for PHP4 without any parameters and when I looked at the output, I do see that PHP seems to recognize that mySQL is there :

....
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock
checking for inline... (cached) inline
.....

Hence, why is that when I do phpinfo() , mySQL still doesn't show up?

I suspect that mysql isn't working correctly with php, because if I use the mysql_connect() function in my php, I get the error "Fatal error: Call to undefined function: mysql_connect() "

Please help, thanks. I am pretty sure my MySQL is properly installed because I can mysql into the server and set up my database
 
Old 06-26-2004, 04:39 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Look at your php.ini first and make sure these lines exist :
extension=mysql.so
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

extension_dir = "/usr/lib/php/extensions/" <-- adapt it to suit your system, mysql.so is here
 
Old 06-27-2004, 01:33 AM   #3
d2army
Member
 
Registered: Jun 2004
Posts: 49

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by keefaz
Look at your php.ini first and make sure these lines exist :
extension=mysql.so
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

extension_dir = "/usr/lib/php/extensions/" <-- adapt it to suit your system, mysql.so is here

Hi, there, I tried to do what u told me to and I found these lines in the php.ini file :

mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =


Thus, I am missing the extension, extension_dir , mysql.connect_timeout and mysql.trace_mode lines . Is the mysql.so supposed to be installed along with MYSQL? I can't seem to find it anyway on my system.
 
Old 06-27-2004, 02:23 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
in my slackware system, mysql.so is installed by php-4.3.7-i486-1 package. But if you have to compile php try
$ locate mysql.h
that will help you to figure out where mysql headers are (assuming your locate db is up to date)
 
Old 06-27-2004, 08:54 PM   #5
d2army
Member
 
Registered: Jun 2004
Posts: 49

Original Poster
Rep: Reputation: 15
I am using RH9 and am using the complete PHP source code php-4.3.7.tar.gz from http://www.php.net/downloads.php directly. So how can I get my mysql.so file?


When I do locate mysql.h , I do see the file in several locations :
/root/php-4.3.7/ext/dbx/dbx_mysql.h
/root/php-4.3.7/ext/mysql/php_mysql.h
/root/php-4.3.7/ext/mysql/libmysql/mysql.h
/root/mysql-standard-4.0.20-pc-linux-i686/include/mysql.h
/usr/include/mysql/mysql.h

I tried doing ./configure --with-mysql= with the three directories where mysql.h exists (i.e. /root/php-4.3.7/ext/mysql/libmysql/ , /root/mysql-standard-4.0.20-pc-linux-i686/include/ and /usr/include/mysql/ ) However, the same "configure: error: Cannot find MySQL header files under ...." error message still keeps coming up.

Thanks for helping me
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql-server4.1 and mod php-mysql conflig kernelvn *BSD 0 06-18-2005 11:52 AM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 02:54 PM
Installing MySQL.4.0.17 and php support for Mysql on RedHat 9.0 Neha Linux - Software 13 12-29-2003 12:06 AM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 08:59 PM
problem with mysql and php nshoboul Linux - Software 3 11-07-2003 02:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration