PHP Connect
PHP Connect

Reputation: 549

Unable to compile PHP 5.2 with mysqli extension

I am compiling PHP version 5.2 with mysql extension mysqli

bellow are the steps

  1. Configure

sudo ./configure --with-mysqli=/opt/mysql/server-5.1/bin/mysql_config

[It's working fine mysql version is 5.1 i have also try with latest]

  1. make

make

[After make bellow error i am getting]

-lmysqlclient -lz -lcrypt -lnsl -lm -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt -o sapi/cgi/php-cgi ext/mysqli/mysqli_repl.o: In function zif_mysqli_disable_reads_from_master': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:43: undefined reference tomysql_disable_reads_from_master' ext/mysqli/mysqli_repl.o: In function zif_mysqli_disable_rpl_parse': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:59: undefined reference tomysql_disable_rpl_parse' ext/mysqli/mysqli_repl.o: In function zif_mysqli_enable_reads_from_master': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:76: undefined reference tomysql_enable_reads_from_master' ext/mysqli/mysqli_repl.o: In function zif_mysqli_enable_rpl_parse': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:93: undefined reference tomysql_enable_rpl_parse' ext/mysqli/mysqli_repl.o: In function zif_mysqli_master_query': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:111: undefined reference tomysql_master_query' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_parse_enabled': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:130: undefined reference tomysql_rpl_parse_enabled' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_probe': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:147: undefined reference tomysql_rpl_probe' ext/mysqli/mysqli_repl.o: In function zif_mysqli_rpl_query_type': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:168: undefined reference tomysql_rpl_query_type' ext/mysqli/mysqli_repl.o: In function zif_mysqli_slave_query': /usr/local/src/php5-build/php-5.2.5/ext/mysqli/mysqli_repl.c:207: undefined reference tomysql_slave_query' collect2: ld returned 1 exit status make: * [sapi/cgi/php-cgi] Error 1

Please let me know the solution

Upvotes: 1

Views: 7719

Answers (3)

SEAN
SEAN

Reputation: 1

Remove the default mysqlclient-dev:

sudo apt-get remove libmysqlclient-dev

Install libmysqlclient-dev_5.6.25

sudo wget http://launchpadlibrarian.net/212189147/libmysqlclient-dev_5.6.25-0ubuntu1_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.6.25-0ubuntu1_amd64.deb
wget http://launchpadlibrarian.net/212189159/libmysqlclient18_5.6.25-0ubuntu1_amd64.deb
sudo dpkg -i libmysqlclient18_5.6.25-0ubuntu1_amd64.deb

I am fine!

Upvotes: 0

PHP Connect
PHP Connect

Reputation: 549

I have run this command

sudo ./configure --disable-all --with-mysql=/opt/mysql/server-5.1/ --with-mysqli=/opt/mysql/server-5.1/bin/mysql_config

and it's working in my previous command i am missing the /opt/mysql/server-5.1/

Upvotes: 0

JSON
JSON

Reputation: 1835

My guess is that your including header files from the wrong version of MySQL client. The php-mysql extension that your trying to build along with PHP 5.2 is 5+ years old and will require the library and headers from the appropriate MySQL version(s). Just doing something like 'apt-get install mysql-client mysql-client-dev' will install a recent versions, so you will likely need to download an older version and build it yourself and tell ./configure where to find the mysql headers (something like ./configure -with-mysqli=/path/to/old/headers)

edit: note that the configure flag is very important or else you will still include the wrong headers (based on your systems includes path)

Upvotes: 1

Related Questions