LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP throws configure errors when trying to compile w/ mysql (https://www.linuxquestions.org/questions/linux-server-73/php-throws-configure-errors-when-trying-to-compile-w-mysql-483224/)

mrtwice 09-13-2006 03:36 PM

PHP throws configure errors when trying to compile w/ mysql
 
I am trying to compile PHP 5.1.6 with support for MySQL 4.1.x on a Fedora Core 1 VPS. This is my config string:

Code:

./configure --with-apxs2=/usr/sbin/apxs --with-mysql
and this is always the result

Code:

checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

I have also downloaded a new mysql version and stored it in a different directory and tried the following config string:

Code:

./configure --with-apxs2=/usr/sbin/apxs --with-mysql=../mysql/usr/lib/mysql --with-zlib
but I get the same error as above.

I am lost when looking at the config.log, but here is the relevant part:

Code:

configure:58533: checking for mysql_close in -lmysqlclient
configure:58552: gcc -o conftest -I/usr/include -g -O2  -L/usr/lib  conftest.c -lmysqlclient  -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 58541 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_close();

int main() {
mysql_close()
; return 0; }
configure:58773: checking for mysql_error in -lmysqlclient
configure:58792: gcc -o conftest -I/usr/include -g -O2  -L/usr/lib  -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient  -lz -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 58781 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_error();

int main() {
mysql_error()
; return 0; }

I have been working on this for hours now and I am at the end of my rope. Please help!

Thank you.

I have tried may variations of the --with-mysql including:

--with-mysql=shared
--with-mysql-/usr/lib/mysql (which is where mysql is installed)

Nothing I try works, I always get the error noted above.

generic_user 09-13-2006 07:06 PM

[QUOTE=mrtwice]I am trying to compile PHP 5.1.6 with support for MySQL 4.1.x on a Fedora Core 1 VPS. This is my config string:

Code:

./configure --with-apxs2=/usr/sbin/apxs --with-mysql
and this is always the result

Code:

checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.


Looks like you don't have the mysql-devel rpm installed.

bathory 09-14-2006 01:50 AM

Try to add
Code:

–with-mysqli=/path/to/mysql/bin/mysql_config
It's needed in php 5.x version

mrtwice 09-14-2006 09:29 AM

Quote:

Originally Posted by bathory
Try to add
Code:

–with-mysqli=/path/to/mysql//bin/mysql_config
It's needed in php 5.x version

Code:

./configure --with-apxs2=/usr/sbin/apxs --with-mysqli=/usr/bin/mysql_config --with-zlib
The line above worked just fine. However, when I compiled, the mysql functions were not available, just the mysqli functions.

I also tried:

Code:

./configure --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/lib/mysql --with-mysqli=/usr/bin/mysql_config --with-zlib
so that the mysql functions were also compiled, but no luck. I got the same errors as before:

Code:

checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

I looked again in the config.log and found this right before the mysql errors:

Code:

gcc -o conftest -I/usr/include -g -O2  -L/usr/lib  -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient  -lz -lz -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lmysqlclient

It looks to me that the line above is not using the correct directory string for -L it should read /usr/lib/mysql. However, I am not a C guy, so I might be wrong.

Still frustrated and will appreciate any help you can give. Thanks.

bathory 09-14-2006 12:50 PM

How did you installed mysql? Using your distro's package manager, using a binary or compiled from source (downloaded from mysql.com)? Cause I never had problems compiling php and using either a binary, or compiled from source mysql. Note that the mysql packages of the various distros are splitted into parts like mysql, mysql-devel, mysql-client etc, so you may need to install all of them to get the required libraries.

Regards

mrtwice 09-14-2006 04:34 PM

Quote:

Originally Posted by generic_user
Looks like you don't have the mysql-devel rpm installed.

No, it is installed.

mrtwice 09-14-2006 04:38 PM

Quote:

Originally Posted by bathory
How did you installed mysql? Using your distro's package manager, using a binary or compiled from source (downloaded from mysql.com)? Cause I never had problems compiling php and using either a binary, or compiled from source mysql. Note that the mysql packages of the various distros are splitted into parts like mysql, mysql-devel, mysql-client etc, so you may need to install all of them to get the required libraries.

Regards

Initially, it was installed by the distros (FC1) RPMS. However, I also downloaded the latest 4.1.x binaries from mysql.com and stored them in a different location. I then tried to use

Code:

./configure --with-mysql=/path/to/new/mysql
to get it to use the new binaries. Exact same results.

waitman 09-27-2006 07:23 PM

lmysqlclient error php install
 
Hi,

I get this same lmysqlclient error building php-5.1.6 on a CentOS 4.0 64bit x86_64, using the 5.0 binary from mysql.com.

mysql-standard-5.0.24a-linux-x86_64-glibc23

Oddly, it seems to me to be related to openssl. If I tell the configure to use the openssl built from source (openssl-0.9.8c) I receive the error, however if I tell it to use the libraries that came with the distro (OpenSSL 0.9.7a Feb 19 2003) then php builds fine...

Did you install openssl from source? What version are you running?

Take care,

Waitman

mrtwice 09-27-2006 08:01 PM

Sorry for not posting back earlier. I think my problems were glibc related, but I am not absolutely sure. I ended up downloading the mysql 4.1 package under the heading:

Linux (non RPM, Intel C/C++ compiled, glibc-2.3) downloads

and then it worked. I am thinking that if I built everything from source, I wouldn't have had the problem. However, the above solution worked for me. The package I downloaded was:

mysql-standard-4.1.21-pc-linux-gnu-i686-icc-glibc23.tar.gz

I hope that helps.

DIGITAL39 10-29-2006 08:08 PM

Anyone have a different fix for this? I am trying to install mysql v5.0.27 and php 5.1.6 and I am getting the same error, I tried changing the ssl directory to the old one and I've tried omitting ssl from it all together and nothing is working

mrtwice 10-29-2006 08:28 PM

Quote:

Originally Posted by DIGITAL39
Anyone have a different fix for this? I am trying to install mysql v5.0.27 and php 5.1.6 and I am getting the same error, I tried changing the ssl directory to the old one and I've tried omitting ssl from it all together and nothing is working

Even though you are going with a 5.0.x version, the glibc problem might be the same. Here is the link to the same type of package that I used to fix my problem, but the 5.0.27 version instead of the 4.1.x version:

http://dev.mysql.com/get/Downloads/M.../mysql.he.net/

DIGITAL39 10-29-2006 08:43 PM

Quote:

Originally Posted by mrtwice
Even though you are going with a 5.0.x version, the glibc problem might be the same. Here is the link to the same type of package that I used to fix my problem, but the 5.0.27 version instead of the 4.1.x version:

http://dev.mysql.com/get/Downloads/M.../mysql.he.net/

I tried that package first, it am aparently missing some file. I don't even remember what it was, but I can't run the install_db script. I think it was something in the gcc package, but being on dialup kills downloading a lot of 40mb packages when you are in a rush.

I am just going to wait until I get my drive back that has the slack 11 iso on it. See if it works, but damn this is discouraging.

bathory 10-30-2006 03:24 AM

Since you're using a 64bit arch you should try the 64bit build or compile mysql from source

Regards

DIGITAL39 10-30-2006 06:36 AM

Quote:

Originally Posted by bathory
Since you're using a 64bit arch you should try the 64bit build or compile mysql from source

Regards

I dont have any 64bit machines


All times are GMT -5. The time now is 04:18 PM.