Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache/MySQL/PHP problem

Status
Not open for further replies.

Niclov

Programmer
Jun 28, 2001
45
CA
When trying to start my my Apache web server under FreeBSD, with PHP as a DSO with MySQL support, I get the error: "cannot load /usr/local/apache/libexec/libphp4.so into server: shared module libmysqlclien.so.10 not found"

Under Linux, this was corrected by adding the path to the file in /etc/ld.so.conf, but in FreeBSD, this file does not even exist, and creating it with the pathname does not solve the problem. Anyone know how to remedy this?
 
Did you compile all these from scratch, or did you install from the ports collection?
 
Compiled straight from sources codes, all three of them
 
What was your ./configure for each: Apache, PHP, and MySQL?

After compiling MySQL, did you run mysql_install_db?
 
For Apache it was --prefix=/usr/local/apache
--enable-module=so

MySQL was --prefix=/usr/local/mysql
--with-low-memory

And PHP was --enable-trans-sid
--with-apxs=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql
--enable-ftp

Yes, I ran mysql_install_db as well
 
Yes, I have had a problem like this in the past. You might think that the best way to handle PHP/MySQL is to explicitly set the layout in MySQL, and explicitly set the MySQL arguments in PHP, but that is not the case.

Your best bet is to let MySQL handle it's own prefix with default layout, and just use the default
Code:
--with-mysql
argument in PHP ./configure, without specifying a directory.

The last time I installed MySQL, though, I decided to spend a little more time in the documentation, and I came across this item on optimization, which said "When in doubt, do the following":
Code:
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static
(
Note that some of the above are variables to be set before running ./configure, but on the same line, before hitting "Enter". This worked just fine with my last install of Apache/PHP-4.0.6/MySQL-3.23.39. (And again, I just did "--with-mysql" in PHP.)

When compiling Apache in this sort of situation, I also usually do
Code:
--enable-module=most --enable-shared=max
, because there are a few other nice things you might want later.

Let me know if this works.
 
Yep, that seems to have done the trick, many thanks. Anything else I should know about configuring any of these programs later on?
 
1. See my post at PHP.net about compiling PHP with image-generation extensions: look for the user comment by rick@e-possibility on
2. If you are interested, I also posted a response to the question about how to install PostgreSQL on FreeBSD in the PostgreSQL forum here at Tek-Tips.

3. I also recommend installing the curl extensions (get Curl at and configuring PHP with
Code:
--with-curl=/usr/local
. Curl lets you do some amazing data piping. It basically gives PHP all the capability of the Perl LWP and SSLeay modules, to perform client requests to other websites.

4. You might also want to enable shared memory for some more advanced operations. See for a tutorial on this.

Beyond that, there is just too much you can do with PHP configuration to explain here. Go play ;-).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top