Trouble installing PHP into a fresh Apache + MySQL installation

Hi there, I’ve been working through your book “Build Your Own Database Driven Website Using PHP & MySQL”, and I am currently trying to install PHP + Apache + MySQL on Ubuntu Linux 10.04.

I’ve followed the given instructions exactly, but when I attempt to configure PHP with the command:

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config

But I am given this error during the configuration process:

wrong mysql library version or lib not found. Check
config.log for more information.

Here is what the last lines of config.log say:

configure:60081: checking for MySQL support
configure:60128: checking for specified location of the MySQL UNIX socket
configure:61334: checking for MySQLi support
configure:61381: checking whether to enable embedded MySQLi support
configure:61535: checking for mysql_set_server_option in -lmysqlclient
configure:61554: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden  -Wl,-rpath,/usr/local/mysql/lib -L/usr/local/mysql/lib -L/usr/lib  -lmysqlclient -lz -lcrypt -lnsl -lm -lmygcc conftest.c -lmysqlclient  -lm -ldl -lnsl  -lxml2 -lxml2 1>&5
/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 61543 "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; }

Please help, I have attempted this multiple times now, and I am no “n00b” when it comes to programming.

Just the latest, why?

The latest versions PHP 5.2+ to 5.3+ come bundled with MySQL Native Drive so you wouldn’t need to install or link against MySQL’s supplied Client Library. (That was what you were doing, btw.)

I see thanks, how should I go about changing my configure command so that this would work.

Sorry for all the noob questions, but before I’ve always used Wampserver for my environment, but I really want to setup my own this time.

If I don’t manage to do it, I’ll use the package that Anthony mentioned.

Thanks for all the help so far!

The above command does this for you. :slight_smile:

Oh, Welcome to SitePoint too!

Thanks, I’ll mark the thread as solved.

I’m not quite sure we do that here, but do feel free to post back if you have any other issues.

What version of PHP were you trying to compile? You could have skip the whole MySQL library requirement by using MySQLnd: http://us.php.net/manual/en/mysqlnd.install.php

Thanks Anthony, if I wanted it to run on startup, how would I go about that?

Unless you specifically want to compile PHP, you can install Apache, MySQL & PHP5 on Ubuntu in one go with…


sudo apt-get install lamp-server^

:wink:

It worked, thank you so much, I was puzzling over it for quite a while.

Cheers!

Awesome thanks so much!

I’ll let you know how it goes.

Shouldn’t need to, mysqlnd should be bundled with PHP Source.

Thanks, do I need to download anything else?

I really appreciate the support, I fully intend to give back and help other forum users.

I haven’t gotten to test it yet, but I assume this would work:


./configure --prefix=/usr/local/php \\
--with-apxs2=/usr/local/apache2/bin/apxs \\
--with-mysql=mysqlnd \\
--with-mysqli=mysqlnd \\
--with-pdo-mysql=mysqlnd

Ok, so I ended up using the apt-get lamp-server^ method, because I was having some other troubles.

So where is my htdocs/public_html/www folder (any of the above), located on my system?