• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1386
  • Last Modified:

Compile php with mysqli support

Hi
I am trying to compile php 5.3.8 with mysqli support (mysql 5.5)  (mysql has been compile from source aswell)
this is the compile source

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring --with-gd --with-zlib --with-jpeg-dir --with-png-dir --with-openssl --with-curl --with-mcrypt --with-imap --with-imap-ssl --with-kerberos --with-mysqli=/usr/local/mysql/bin/mysql_config


buts its comming with bellow error

checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
checking for mysql_set_server_option in -lmysqlclient... no
configure: error: wrong mysql library version or lib not found. Check config.log for more information.


Now i have create symlink to
ln -s /usr/local/mysql/lib/libmysqlclient.so.18.0.0 /usr/local/lib/libmysqlclient.so.18

 ln -s /usr/local/mysql/lib/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so.18


but cant get rid of the error
i can see its due to environmental variable..
but dont understand .. how to solved it ..
can any one please help me  ..



0
fosiul01
Asked:
fosiul01
  • 8
  • 4
  • 4
  • +2
1 Solution
 
dbauermannCommented:
Open the "config.log" and try to find the exact error.

You can post here to us look too.
0
 
medveddCommented:
0
 
fosiul01Author Commented:
@dbauermann ;

configure:61239: checking for mysql_set_server_option in -lmysqlclient
configure:61258: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden  -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -L/usr/lib  -Wl,-rpath,/usr/kerberos/lib64 -L/usr/kerberos/lib64 -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lrt -ldl conftest.c -lmysqlclient  -lmysqlclient -lmcrypt -lltdl -lcrypt -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -ldl -lz 1>&5
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/librt.a when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib/libdl.so when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/lib/libdl.a when searching for -ldl
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
configure: failed program was:
#line 61247 "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_set_server_option();

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


@medvedd

if you read my post.. i had created symlink... but no luck ..

may be i am not creating in right directory.
the article. you sent its not that clear ..
can you be little bit more specifi please
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
dbauermannCommented:
Do you have the "glibc" installed in your system?

The compiler didn't find libraries that are in glibc package (in my system).
0
 
fosiul01Author Commented:
yes, its installed

Package glibc-2.5-65.x86_64 already installed and latest version
Package glibc-2.5-65.i686 already installed and latest version
0
 
dbauermannCommented:
Redhat-like (with RPM) or Debian-like (with apt-get)?
0
 
fosiul01Author Commented:
as you can see, its already installed (its centos)
0
 
dbauermannCommented:
Try to execute this command:

rpm -qal | grep "libm.a"

If the result has a line with "/usr/lib/libm.a", then list the contet of "/etc/ld.so.conf".
0
 
fosiul01Author Commented:
[root@hostphp-5.3.8]# rpm -qal | grep "libm.a"
/usr/lib64/libm.a
/usr/lib/libm.a
[root@posrep php-5.3.8]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
0
 
arnoldCommented:
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH

make sure you do not have two versions of mysql installed or your /usr/lib is the path where the compiler/linker is looking for the libraries you are trying to include.


Bad practice to create symlinks as you've done.

check /etc/ld.so.conf.d/mysql.conf and make sure it has /usr/local/mysql/lib
ldconfig
0
 
fosiul01Author Commented:
Hi
i will delete those symlinks!!

but i dont have any file
/etc/ld.so.conf.d/mysql.conf

what to do with that ?
0
 
xtermCommented:
You don't have "--with-mysqli" in your configure string - why?
0
 
fosiul01Author Commented:
@xterm
sorry what you meant ???

i do have ,

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring --with-gd --with-zlib --with-jpeg-dir --with-png-dir --with-openssl --with-curl --with-mcrypt --with-imap --with-imap-ssl --with-kerberos --with-mysqli=/usr/local/mysql/bin/mysql_config
0
 
xtermCommented:
I would try using:
 --enable-embedded-mysqli
0
 
fosiul01Author Commented:
but accordign to php document

http://www.php.net/manual/en/mysqli.installation.php

it say to use --with-mysqli=/path/to/mysql_config


its php 5.3.8
0
 
xtermCommented:
Take a look at:

[xterm@foo php-5.3.8]$ ./configure --help | grep -A2 mysqli
  --with-mysqli[=FILE]    Include MySQLi support.  FILE is the path
                          to mysql_config.  If mysqlnd is passed as FILE,
                          the MySQL native driver will be used [mysql_config]
  --enable-embedded-mysqli  MYSQLi: Enable embedded support
                            Note: Does not work with MySQL native driver!

The native driver doesn't seem to be working for you, that's why I'm suggesting trying the embedded instead.
0
 
fosiul01Author Commented:
by adding

export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH

its compied ..

let it finished fully then i will be able to tell
0
 
xtermCommented:
> configure: error: wrong mysql library version or lib not found. Check config.log for more information.

I should've noticed that from the beginning, good catch.  That will actually probably work fine.

Keep in mind now that you may have to now add that export command to your Apache startup scripts, or you can create a file called mysql in /etc/ld.so.conf.d and put "/usr/local/mysql/lib" in it, and then run /sbin/ldconfig
0
 
arnoldCommented:
If you do not have mysql.conf or mysql-i386.conf or mysql-i686.conf or however centos/redhat include those settings
add one mysql.conf and set the path as /usr/local/mysql/lib and that should do it..

when done run ldd php and see whether it finds the mysql related linked/shared libraries in /usr/local/mysql/lib or it references a /usr/lib/mysql location.
0
 
arnoldCommented:
IMHO, if you compile your own apps, try to avoid having the same apps from the distro. The difficulty is that at times there are distro apps that rely on other distro apps.

In your case, it seems you want the newer version of PHP versus sticking with the version that comes with the OS distro you are using. Having the latest and greatest at times is not the optimal thing.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 4
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now