LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 (http://www.linuxquestions.org/questions/programming-9/problem-getting-php-to-recognize-mysql-using-php-4-0-and-mysql-4-0-20-a-197727/)

d2army 06-25-2004 04:42 PM

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

keefaz 06-26-2004 05:39 AM

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

d2army 06-27-2004 02:33 AM

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.

keefaz 06-27-2004 03:23 PM

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)

d2army 06-27-2004 09:54 PM

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


All times are GMT -5. The time now is 11:28 PM.