Welcome! Log In Create A New Profile

Advanced

Extension conflicts (Imagick, Suhosin, APC) when upgrading from PHP 5.2.6 to 5.3.3

Posted by StefanScott 
Extension conflicts (Imagick, Suhosin, APC) when upgrading from PHP 5.2.6 to 5.3.3
October 19, 2010 02:15PM
Hi -

I'm having a problem which might be more about PHP or PHP-FPM (and not nginx per se), but I am posting it here in case anyone has any ideas.

I'm on Debian 5, and I'm following the instructions here:

http://vladgh.com/blog/install-nginx-and-php-533-php-fpm-mysql-and-apc

to upgrade PHP from 5.2.6 to 5.3.3 and MySQL from 5.0.51 to 5.1.51 (I need this in order to upgrade from MODx Evolution to Revolution).

I also had nginx 0.6.33 for a long time, working fine - so now I'm taking this opportunity to upgrade to 0.8.52 also.

Almost everything worked fine above in the post from Vlad (also thanks for the comment there from someone about 'touch') - but I am having one small problem:

I can compile and phpize Imagick and Suhosin for PHP 5.3.3 - but now they are always being configured for PHP 5.2.6. This seems to be due to some "lingering" or "lurking" configuration settings somewhere - but I cannot find where to set this. (Something similar is happening with APC - although it's being configured using 'pecl' instead of './configure'.)

PHP-FPM only starts when I comment out the lines for the extensions in /opt/php5/php.ini:
[code]
extension = suhosin.so
extension = imagick.so
extension = apc.so
apc.enabled = 1
apc.shm_size = 128M
apc.shm_segments=1
apc.write_lock = 1
apc.rfc1867 = On
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
[/code]

When I am configuring imagick (and suhosin), it is always using the *old* PHP 5.2.6 prefix (/usr/local/), not the *new* PHP 5.3.3 prefix (/opt/php5).

This can be seen by looking at the output for './configure' with imagick. (The output is similar for suhosin):
[code]
myserver ~/sources/imagick-3.0.0: echo $PATH
/opt/php5/bin:/opt/php5/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
myserver ~/sources/imagick-3.0.0: sudo /opt/php5/bin/phpize -clean
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
myserver ~/sources/imagick-3.0.0: sudo ./configure --prefix=/opt/php5 --with-config-file-path=/opt/php5/etc --with-imagick
loading cache ./config.cache
checking for Cygwin environment... (cached) no
checking for mingw32 environment... (cached) no
checking for egrep... (cached) grep -E
checking for a sed that does not truncate output... (cached) /bin/sed
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -c and -o together... (cached) yes
checking for system library directory... lib
checking if compiler supports -R... (cached) no
checking if compiler supports -Wl,-rpath,... (cached) yes
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... (cached) re2c
checking for re2c version... (cached) 0.13.5 (ok)
checking for gawk... (cached) nawk
checking if nawk is broken... no
checking whether to enable the imagick extension... yes, shared
checking whether to enable the imagick GraphicsMagick backend... no
checking ImageMagick MagickWand API configuration program... found in /usr/local/bin/MagickWand-config
checking if ImageMagick version is at least 6.2.4... found version 6.6.5 Q16
checking for MagickWand.h header file... found in /usr/local/include/ImageMagick/wand/MagickWand.h
checking PHP version is at least 5.1.3... yes. found 5.2.6
checking build system type... i686-pc-linux-gnu
checking for ld used by gcc... (cached) /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... (cached) yes
checking for /usr/bin/ld option to reload object files... (cached) -r
checking for BSD-compatible nm... (cached) /usr/bin/nm -B
checking whether ln -s works... (cached) yes
checking how to recognize dependent libraries... (cached) pass_all
checking for object suffix... (cached) o
checking for executable suffix... (cached) no
checking for dlfcn.h... (cached) yes
checking the maximum length of command line arguments... (cached) 98304
checking command to parse /usr/bin/nm -B output from gcc object... (cached) ok
checking for objdir... (cached) .libs
checking for ar... (cached) ar
checking for ranlib... (cached) ranlib
checking for strip... (cached) strip
checking if gcc supports -fno-rtti -fno-exceptions... (cached) no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... (cached) yes
checking if gcc static flag -static works... (cached) yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
creating ./config.status
creating config.h
config.h is unchanged
[/code]


The lines above:
[code]
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
[/code]
show the cause of the problem. It should say '/opt/php5' instead of '/usr/local'.



I have tried deleting the directories (imagick-3.0.0, suhosin-0.9.32.1) and re-creating them using tar.

I have tried adding options '--prefix=/opt/php5 --with-config-file-path=/opt/php5/etc' to the './configure' command for imagick-3.0.0. But nothing seems to work.

I tried copying the files imagick.so and suhosin.so from /usr/local/lib/php/extensions/no-debug-non-zts-20060613 to '/opt/php5/lib/php/extensions/no-debug-non-zts-20090626', and uncommenting the lines in php.ini, and restarting php-fpm, but then I got an error message saying the .so files were not compatible with this build.

I do not understand why the command './configure' for imagick (and for suhosin) uses the old PHP prefix.

If I go to the main page '/' of any of my sites, my browser now shows the generic non-PHP page /opt/nginx/html/index.html "Welcome to MyServer.com" for all sites - and doesn't log an error.

If I go to http://myserver.com/info.php I get "site down" from the browser - and the following line shows up in the error log.
[code]
2010/10/19 06:35:31 [error] 16622#0: *83 open() "/opt/nginx/html/info.php" failed (2: No such file or directory), client: XXX.XXX.XXX.XXX, server: localhost, request: "GET /info.php HTTP/1.1", host: "myserver.com"
[/code]
And if I do a test by going to a fake page like '/foo.html' I get "404 not found - nginx 0.8.52' from nginx in the browser.

So nginx seems to be working somewhat, but it's not working correctly with PHP / PHP-FPM. I don't know if this would happen simply because Imagick and Suhosin and APC are not configured properly - or maybe something is wrong in /otp/nginx/conf/nginx.conf (I tried to update it correctly), or with my fastcgi_params file (I have left this unchanged in upgrading from nginx 0.6.33 to 0.8.52).


I also wonder if the $PATH environment variable could be causing the whole problem with Imagick, Suhosin and APC compiling for PHP 5.3.3 and configuring for 5.2.6:
[code]
myserver ~/sources/imagick-3.0.0: echo $PATH
/opt/php5/bin:/opt/php5/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
[/code]
because I have to use 'sudo' all the time to run '/opt/php5/sbin/phpize' and to run './configure' - so maybe this invokes the shell for the superuser, and maybe different environment variables are used - only during the execution of phpize and ./configure?!?


Anyways, I restored from a backup and will try this again later when I am less tired. If worse comes to worse, this is just an evaluation box which has already been upgraded from Debian 4 to 5. Sometimes I think I'll just re-start from scratch with a fresh install of Debian 5 (first backing up a few hard-to-remember settings, like the current iptables firewall configuration) - and then install PHP 5.3.3 instead of upgrading from PHP 5.2.6 - which should definitely avoid the problem of "lurking" PHP configuration settings.

Any ideas would be welcome. Thanks.
On 10/19/2010 10:15 PM, StefanScott wrote:
> I can compile and phpize Imagick and Suhosin for PHP 5.3.3 - but now
> they are always being configured for PHP 5.2.6. This seems to be due to
> some "lingering" or "lurking" configuration settings somewhere - but I
> cannot find where to set this. (Something similar is happening with APC
> - although it's being configured using 'pecl' instead of
> './configure'.)

Well, it's hardly a PHP-FPM problem.
You need to specify php-config that belongs to the version you're expecting the extensions to work with.
To do that use --with-php-config=/opt/php5/bin/php-config (or whatever your path is).

---
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP
Also, shouldn't "make clean" be considered as well?

On Wed, Oct 20, 2010 at 3:43 AM, Antony Dovgal <tony@daylessday.org> wrote:

> On 10/19/2010 10:15 PM, StefanScott wrote:
> > I can compile and phpize Imagick and Suhosin for PHP 5.3.3 - but now
> > they are always being configured for PHP 5.2.6. This seems to be due to
> > some "lingering" or "lurking" configuration settings somewhere - but I
> > cannot find where to set this. (Something similar is happening with APC
> > - although it's being configured using 'pecl' instead of
> > './configure'.)
>
> Well, it's hardly a PHP-FPM problem.
> You need to specify php-config that belongs to the version you're expecting
> the extensions to work with.
> To do that use --with-php-config=/opt/php5/bin/php-config (or whatever your
> path is).
>
> ---
> Wbr,
> Antony Dovgal
> ---
> http://pinba.org - realtime statistics for PHP
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 336
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready