OpenWrt Forum Archive

Topic: Compiling php with mysql

The content of this topic has been archived on 30 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I'm currently trying to compile php5 with mysql support (as an extension).
I succeeded compiling a fastcgi binary without mysql, you can get it here :

http://www.ohardt.com/computer/dev/openwrt/binaries/

It works perfectly with thhtpd compiled by aorlinsk.

Anyway, when running ./configure and trying to include the mysql libraries I run into the problem that the compiler (linker ?) complains that it can't find libz.so.1 that libmysqlclient.so requires. All the libraries are in place, I even linked libz.so.1 from the ../usr/lib/myqsl directory but no success.

I think I can fix the problem by adding -rpath-link with the path to the libz binaries to the linker ( ld ) but I have no idea how to do that.

Any ideas anyone ?

  Oliver

aorlinsk wrote:

Hello,

I have compiled PHP5 with MySQL support. If you want to test the packages (i made no testing myself) you can find them in http://aorlinsk2.free.fr/openwrt/ipkg/php5/ , and the source package can be found in http://aorlinsk2.free.fr/openwrt/ipkg-src/

Please advise me whether if the packages are working.

Anael

By the way: as you guys are at it, please consider creating a PHP for OpenWRT with Sqlite support. This would allow totally self-contained applications, without need for an external RDBMS. Incidentally, Sqlite itself has already been ported to OpenWRT by Florian Fainelli: http://nthill.free.fr/openwrt/tracker/p … hp?id=1733 . (That package includes also libsqlite3.a and sqlite3.h, which are required for development but may be removed at runtime).

Enzo

Hi Anael and Enzo,

I started integrating the PHP sources from Anael (aorlinsk) into CVS. I'm extending them to provides as much extensions as we can (MySQL, PostgreSQL, LDAP, SQLite...). It should be ready on monday.

Thanks for your great work and your help

enzo wrote:
aorlinsk wrote:

Hello,

I have compiled PHP5 with MySQL support. If you want to test the packages (i made no testing myself) you can find them in http://aorlinsk2.free.fr/openwrt/ipkg/php5/ , and the source package can be found in http://aorlinsk2.free.fr/openwrt/ipkg-src/

Please advise me whether if the packages are working.

Anael

By the way: as you guys are at it, please consider creating a PHP for OpenWRT with Sqlite support. This would allow totally self-contained applications, without need for an external RDBMS. Incidentally, Sqlite itself has already been ported to OpenWRT by Florian Fainelli: http://nthill.free.fr/openwrt/tracker/p … hp?id=1733 . (That package includes also libsqlite3.a and sqlite3.h, which are required for development but may be removed at runtime).

Enzo

Hi,

This is not a problem to include SQLite, I think I already managed to do it.
But I'd like to use the shared SQLite package (3.x) provided by Florian Fainelli.
So, quick summary :
PHP 5.0.4 => SQLite 2.x built in, this doesn't use shared libs and takes more space.
PHP 5.1.0b2 => SQLite 3.x with dbo extension, I couldn't figure out how to avoid using the built-in SQLite 3

I'll have a try to tweak PHP 5.1.0b2 tonight to use shared SQLite lib.

Anael

Anael,

have you tried using the extension from PECL ?
I'm planning to use it to add SQLite to PHP4.

aorlinsk wrote:

Hi,

This is not a problem to include SQLite, I think I already managed to do it.
But I'd like to use the shared SQLite package (3.x) provided by Florian Fainelli.
So, quick summary :
PHP 5.0.4 => SQLite 2.x built in, this doesn't use shared libs and takes more space.
PHP 5.1.0b2 => SQLite 3.x with dbo extension, I couldn't figure out how to avoid using the built-in SQLite 3

I'll have a try to tweak PHP 5.1.0b2 tonight to use shared SQLite lib.

Anael

Yes, using the shared SQLite is definitely better, as other applications might want to use as well. "./configure --help" suggests:

[...]
  --without-sqlite      Do not include sqlite support.
                          Use --with-sqlite=DIR to specify DIR where
                          Sqlite include and library files are located,
                          if not using bundled library.
[...]

Alternatively, you might consider porting PHP4, which is probably also smaller.

Enzo

Anael,

since SQLite3 is already in CVS, you can try what Enzo suggests :

./configure \
  ... \
  --with-sqlite="$(STAGING_DIR)/usr" \
  ... \

Hi,

As far as I know, the PHP module provided for SQLite in PHP 5.0.x (or the one you find for PHP4 in PECL), the one you configure with --with-sqlite=[DIR], is suitable only for SQLite 2.x

If we want to use AND link with SQLite 3.x (the one is in CVS), it is only possible with new pdo extension (available in PHP 5.1.0b2 or in PECL for PHP 5.0.3+).
However it looks like we have to use bundeled SQLite 3.x (provided with pdo). I need a way to do --with-pdo-sqlite=[DIR], unfortunately this doesn'nt work.

If you want the base files for php 5.1.0b2 (ipkg source), you can find them here http://aorlinsk2.free.fr/openwrt/ipkg-src/  but job is not finished (package creation has to be updated)

Also note that I can't get xml modules to work out-of-the-box. I'll surely have a look at this later (it worked in PHP4).

Anael

aorlinsk wrote:

Hi,

As far as I know, the PHP module provided for SQLite in PHP 5.0.x (or the one you find for PHP4 in PECL), the one you configure with --with-sqlite=[DIR], is suitable only for SQLite 2.x

If we want to use AND link with SQLite 3.x (the one is in CVS), it is only possible with new pdo extension (available in PHP 5.1.0b2 or in PECL for PHP 5.0.3+).
However it looks like we have to use bundeled SQLite 3.x (provided with pdo). I need a way to do --with-pdo-sqlite=[DIR], unfortunately this doesn'nt work.
[...]

Perhaps it would be wise to wait for stable releases, and for now stick to SQLite 2.8.14 and perhaps also PHP 4.3.9, don't you think? That's the approach taken by RHEL and other distributions thought for production systems... Although I don't know how easy it would be to integrate SQlite in PHP4 without having to install PEAR and relative overhead.

Also, for OpenWRT that space is at a premium, so I'd happily trade advanced features for smaller size of the executables.

Cheers --

Enzo

PHP4 was added in CVS (HEAD) yesterday.

There are 3 versions :
. cli : PHP4 compiled as CLI (for interactive use)
. cgi : PHP4 as a CGI
. fastcgi : PHP4 for use with a FastCGI compatible server (lighttpd)

The following extensions are available :
. ftp
. gd
. ldap
. mysql
. openssl
. pcre
. postgresql
. sessions
. socket
. sqlite
. xml

Feedback welcome !

Thanks Anael and Enzo for the help.

Hey,

sorry for totally missing out on this thread, was gone for the 4th of July weekend.

I finally managed to get php 5 (5.1b2 and 5.0.4)  compiled inculding mysql as a shared module.
I use the configure as it shows phpconfig of the php aorlinsk compiled but my executable is rought 4 to 5 MB large which is HUGE compared to aorlinsks php (slightly over 1MB).

So I guess the questions is directed to aorlinsk, how do you keep the executables so small ? 

I'd be more than happy to prepare some php5.1.b2 packages but right now they're way too large.

Cheers,

  Oliver

Oliver wrote:

Hey,

sorry for totally missing out on this thread, was gone for the 4th of July weekend.

I finally managed to get php 5 (5.1b2 and 5.0.4)  compiled inculding mysql as a shared module.
I use the configure as it shows phpconfig of the php aorlinsk compiled but my executable is rought 4 to 5 MB large which is HUGE compared to aorlinsks php (slightly over 1MB).

So I guess the questions is directed to aorlinsk, how do you keep the executables so small ? 

I'd be more than happy to prepare some php5.1.b2 packages but right now they're way too large.

Cheers,

  Oliver

I think you have to explicitely disable some extensions and features using --without-xxxx or by enabling the shared creation of shared libraries, using --with-xxxxx=shared,PATH

Maybe what happens is your php binary is not able to load shared libraries, so the extensions are builtin and thus the executable is huge.

You can have a look at the makefiles I used to deliver the modules, included in the source packages you'll find here http://aorlinsk2.free.fr/openwrt/ipkg-src/

The discussion might have continued from here.