| Frames | Modems | Help | Home Page | Chipsets | Search | No Frames |
| Diary Entries | See also Site Info & Diary. | |
| 18 April 2004 | Installing PHP 4.3.6 on Red Hat Linux 8 (Pain #2)... | |
16 Apr: The story so far: these pages are delivered up to your browser by Apache 2.0.40, the default web-server provided with RedHat 8, and all working under Linux 2.4 on a super-duper custom-built beast (called Olivia) located within a swish co-location in Manchester, England. Unfortunately, zombie httpd processes keep appearing (shades of recent movies, huh?) on an infrequent basis, shown by a <defunct> at the end of the line in a server ps -aux listing. Every few days, Apache is set to re-spawn a new Parent Server Generation, and these Zombies get spiked. Every so often, however, one or more of them prove to be tougher and refuse to die, clinging on to one of the little CPUs for dear life, like some electronic vampire. This is not a happy situation for a production server. The server is only 9 months old, yet the support on RH8 is due to be phased out soon. Later Red Hat distributions will not offer any relief, however, as they all make use of php4 & a version of Apache (Apache2) which PHP fulminates is not to be used in a production environment neither on Unix nor on Windows. Hmm. Both RH & Apache seem to be keeping very quiet about all this. After many months of bitter experience, it has started to become plain that PHP needed to be upgraded. Ah, problem - the latest version that RH8 offers is php-4.2.2. So, biting the bullet, I began to engage with Pain #1 - installing php-4.3.5. Now, weeks later, the bugs are ironed out and (fanfare) official release php-4.3.6 is here. OK, gird up the loins, and here we go. |
||
Although php-4.3.5 was never installed, I did successfully get it to make. The sensible thing, then, was to follow exactly the same footpath that led to a result with the earlier version when compiling 4.3.6: # lynx http://www.php.net/downloads.php [about 8 kbps] # cp php-4.3.6.tar.gz /usr/src/ # cd /usr/src # gunzip php-4.3.6.tar.gz # tar -xvf php-4.3.6.tar # cd php-4.3.6 # .configure (lots of stuff - see Pain #1) ... Generating files updating cache ./config.cache creating ./config.status creating php4.spec creating main/build-defs.h creating scripts/phpize creating scripts/php-config creating sapi/cli/php.1 creating main/php_config.h creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ | *** NOTE *** | | The default for register_globals is now OFF! | | | | If your application relies on register_globals being ON, you | | should explicitly set it to on in your php.ini file. | | Note that you are strongly encouraged to read | | http://www.php.net/manual/en/security.registerglobals.php | | about the implications of having register_globals set to on, and | | avoid using it if possible. | +--------------------------------------------------------------------+ Thank you for using PHP. So far so good. make was not so happy... # make ... /bin/sh /usr/src/php-4.3.6/libtool --silent --preserve-dup-deps --mode=compile gcc \ -I/usr/src/php-4.3.6/ext/gd/libgd -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE -Iext/gd/ \ -I/usr/src/php-4.3.6/ext/gd/ -DPHP_ATOM_INC -I/usr/src/php-4.3.6/include -I/usr/src/php-4.3.6/main \ -I/usr/src/php-4.3.6 -I/usr/src/php-4.3.6/Zend -I/usr/include/libxml2 -I/usr/include/freetype2 \ -I/usr/include/imap -I/usr/kerberos/include -I/usr/include/mysql -I/usr/include/ncurses \ -I/usr/include/pspell -I/usr/src/php-4.3.6/TSRM -g -O2 -prefer-pic -c \ /usr/src/php-4.3.6/ext/gd/libgd/gdft.c -o ext/gd/libgd/gdft.lo /usr/src/php-4.3.6/ext/gd/libgd/gdft.c: In function `fontFetch': /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:478: `FT_ENCODING_MS_SYMBOL' undeclared \ (first use in this function) /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:478: (Each undeclared identifier is reported only once /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:478: for each function it appears in.) /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:479: `FT_ENCODING_ADOBE_CUSTOM' undeclared \ (first use in this function) /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:479: `FT_ENCODING_ADOBE_STANDARD' undeclared \ (first use in this function) /usr/src/php-4.3.6/ext/gd/libgd/gdft.c: In function `gdImageStringFTEx': /usr/src/php-4.3.6/ext/gd/libgd/gdft.c:974: `FT_ENCODING_MS_SYMBOL' undeclared \ (first use in this function) make: *** [ext/gd/libgd/gdft.lo] Error 1 No point in boring you with all the things I tried, but I will emphasise that the system uses Freetype 2.1.2 and, remember, it all ran fine with php-4.3.5. |
||
17 Apr: Plenty of people with the same problem (see this BSD forum thread as just one example) but no solutions. |
||
18 Apr: After much Googling finally got to Wed Sep 4 19:58:47 2002 FT_ENCODING_MS_SYMBOL typo-fix in freetype.h (the FT_Encoding_ typedef enum was ‘ft_encoding_symbol’ and should have been ‘FT_ENCODING_MS_SYMBOL’). All other FT_Encoding_s also now in UPPER-CASE - that’s clever. Checking the dates on both freetype.h: -rw-r--r-- 1 root root 44056 Aug 29 2002 /usr/include/freetype1/freetype/freetype.h -rw-r--r-- 1 root root 185766 Aug 29 2002 /usr/include/freetype2/freetype/freetype.h Damn! it's an old one (yet is the latest that RH provide). That means that FreeType2 will need installing from source. This was, in fact, the very first time that I compiled a program from source on Linux successfully from beginning to end: # lynx http://sourceforge.net/project/showfiles.php?group_id=3157 [about 48 kbps]
# cp freetype-2.1.7.tar.gz /usr/src/
# gunzip freetype-2.1.7.tar.gz
# tar -xvf freetype-2.1.7.tar
# cd freetype-2.1.7
[read UPGRADE.UNX + INSTALL.UNX (since this is Unix)]
# freetype-config --prefix
/usr
# ./configure --prefix=/usr
cd builds/unix; ./configure --prefix=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
...
configure: creating ./config.status
config.status: creating unix-cc.mk
config.status: creating unix-def.mk
config.status: creating freetype-config
config.status: creating freetype2.pc
config.status: creating ftconfig.h
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler cc
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).
make: Nothing to be done for `unix'.
# make
[masses of stuff]
# make install
/usr/src/freetype-2.1.7/builds/unix/mkinstalldirs /usr/lib
...
-rw-r--r-- 1 root root 193261 Apr 18 14:38 /usr/include/freetype2/freetype/freetype.h
...and that was as easy as can be, plus make on php ran straight through with no problems. My thought now, however--before the final stage of make install--was why not re-build with 'i686-pc-linux-gnu' and take advantage of any extra that my superior platform can offer? The configure command for php now became ./configure '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--target=i686-pc-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2filter=/usr/sbin/apxs' - phew! The configure stage was fine, and so was make. The last stage was make install plus the config files. Time for a cup of tea, then some sleep! |
||
15:37: Refreshed by sleep, breakfast, a cup of tea and a fag (not what you think, American cousins), time to actually install. # make install
Installing PHP SAPI module: apache2filter
/usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/httpd/build/libtool' libphp4.la /usr/lib/httpd/modules
/usr/lib/httpd/build/libtool --mode=install cp libphp4.la /usr/lib/httpd/modules/
cp .libs/libphp4.so /usr/lib/httpd/modules/libphp4.so
cp .libs/libphp4.lai /usr/lib/httpd/modules/libphp4.la
libtool: install: warning: remember to run `libtool --finish /usr/src/php-4.3.6/libs'
chmod 755 /usr/lib/httpd/modules/libphp4.so
[activating module `php4' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /usr/bin/
Installing PHP CLI man page: /usr/share/man/man1/
Installing shared extensions: /usr/lib/20020429/
Installing PEAR environment: /usr/share/pear/
[PEAR] Archive_Tar - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - upgraded: 1.3.1
Warning! a PEAR user config file already exists from a previous PEAR installation at '/root/.pearrc'.\
You may probably want to remove it.
Wrote PEAR system config file at: /etc/pear.conf
You may want to add: /usr/share/pear to your php.ini include_path
[PEAR] DB - upgraded: 1.6.2
[PEAR] HTTP - already installed: 1.2.3
[PEAR] Mail - upgraded: 1.1.3
[PEAR] Net_SMTP - already installed: 1.2.5
[PEAR] Net_Socket - already installed: 1.0.1
[PEAR] XML_Parser - already installed: 1.0.1
[PEAR] XML_RPC - already installed: 1.1.0
Installing build environment: /usr/lib/php/build/
Installing header files: /usr/include/php/
Installing helper programs: /usr/bin/
program: phpize
program: php-config
program: phpextdist
# ls -al /usr/lib/httpd/modules/libphp4.so
-rwxr-xr-x 1 root root 8216841 Apr 18 15:35 /usr/lib/httpd/modules/libphp4.so
# libtool --finish /usr/src/php-4.3.6/libs
PATH="$PATH:/sbin" ldconfig -n /usr/src/php-4.3.6/libs
----------------------------------------------------------------------
Libraries have been installed in:
/usr/src/php-4.3.6/libs
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Seems fine. OK, quick check of the config files (php had added “LoadModule php4_module libphp4.so” with the full path to the module into httpd.conf) seems OK, no other changes, so let’s roll: # apachectl start [Sun Apr 18 17:17:00 2004] [warn] module php4_module is already loaded, skipping ..plus, whilst .html pages are delivered up OK, php pages show the text of the script rather than a page. Eeek! (it gets worse) # apachectl stop [Sun Apr 18 17:18:23 2004] [warn] module php4_module is already loaded, skipping # /etc/init.d/httpd configtest [Sun Apr 18 17:32:09 2004] [warn] module php4_module is already loaded, skipping Syntax OK (many more hours of Googling + side-alleys cut to spare you) Finally I recall that Apache2 is set to use Filters, and a separate php.conf file is used, with no mention of php in the httpd.conf. Except that now there is, and so two instructions to load php4_module, hence the warning. A grinding of teeth at this moment, but OK - let’s drop the filters & use the ‘ordinary’ method: # ./configure ... '--with-apxs2=/usr/sbin/apxs' apxs:Error: Invalid query string `APR_BINDIR'. ./configure: line 1: /apu-config: No such file or directory ./configure: line 1: /apr-config: No such file or directory configure: error: Please note that Apache version >= 2.0.44 is required. PLEASE NOTE THAT APACHE VERSION >= 2.0.44 IS REQUIRED. !!!!! Do you know, because I have checked very carefully, and there is no explicit warning of this anywhere on either PHP nor Apache. Re-checking PHP docs - Installation - Servers-Apache 2.0 I suddenly realise that all mention of Filters + php.conf + whatever has gone; it is very difficult to see something that is not there. Ah well, PHP will not say it, and Apache are keeping mum, so I guess I’ll have to say it for them:
For the record, after reinstalling the original php using yum and everything was OK, I even tried again from scratch using Apache filters and my original config files. This time--rather than php-pages showing the script source--my browser said “page cannot be displayed”. Even more important, top showed <defunct> httpd processes building up immediately. I hurriedly shut down Apache & reinstalled the original configuration once again. # yum -C install php php-mysql php-imap php-ldap So, after another 3-day head-banging session I agree with the php-people. Apache 2 is pants. What a shame. To be continued. |
||