views:

43

answers:

1

After upgrading php from 5.1 to 5.2.10, I got the following warnings when php -v:

    # php -v
    PHP Warning:  PHP Startup: fileinfo: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: memcache: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mhash: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mssql: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: readline: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: tidy: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP 5.2.10 (cli) (built: Nov 13 2009 11:24:03)
    Copyright (c) 1997-2009 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

How can I fix it? Thanks!

+1  A: 

Looks like you haven't upgraded PHP modules, they are not compatible.

Check extension_dir directive in php.ini. It should point to folder with 5.2 modules.

Since you did upgrade, there is a chance that you are using old php.ini that is pointing to 5.1 modules

bas
`extension_dir` points to `/user/lib/php/modules` in which there are many `.so` files. how can I tell the version of those `.so` files? thx
ohho
When you run php as you did in question, for each incompatible module you will receive warning message:Unable to initialize module Module compiled with module API=20050922In your case incompatible modules are: fileinfo, mcrypt, memcache, mhash, mssql, readline and tidy, so try to disable them and see does it make a difference.
bas
@Horace: If you're on a Unix-like host, try this in the extension dir: `strings -f *.so|grep API`. There may be multiple 'API' strings in each .so, but should only be on with the API version number
Marc B
@Marc, that won't work, at least it didn't on OSX when I tried :)
bas
@bas: hmm. no strings command? grep didn't work? Maybe OSX PHP doesn't include the API version inside the .so file. Could be in the file's metadata (resource fork, extended attributes, whatever it's called these days).
Marc B
bas
@Marc B, `strings -f *.so | grep API` returns nothing meaningful, only some "API version" text but no number.
ohho