22

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!

0

10 Answers 10

23

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

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

Create and open a phpinfo file and search for extension_dir to find the path.

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

Sign up to request clarification or add additional context in comments.

11 Comments

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
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=20050922 In 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.
@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, that won't work, at least it didn't on OSX when I tried :)
@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).
|
14

try to upgrade each of those modules using pecl command

# pecl upgrade fileinfo
# pecl upgrade memcache
# pecl upgrade mhash
# pecl upgrade readline

etc...

1 Comment

by localhost wamp, how can i upgrade in windows?
10

brew reinstall php56-mcrypt --build-from-source

Do this—pass the --build-from-source flag—for each module which needs to be compiled with the same version.

It may also require PHP options depending on your plugins. If so, brew reinstall php56 --with-thread-safety

To see all of the options for php[version] run brew options php56 (replacing 56 with your version)

Comments

2

Erase the module that can't be initialized and reinstall it.

Comments

1

This is an old thread, but I stumbled across it when trying to solve a similar problem.

For me, I got this particular error relating to the php_wincache.dll. I was in the process of updating PHP from 5.5.38 to 5.6.31 on a Windows server. For some reason, not all of the DLL files updated with the newest versions. Most did, but some didn't.

So, if you get an error similar to this, make sure all the extensions are in place and updated.

Comments

0

This is just describing why I had this issue in case someone finds it helpful.

My problem was that I had upgraded php with homebrew and had forced at some point the variable PHP_INI_SCAN_DIR in my profile or bashrc file so it was pointing to the old php version. Removed that line and fixed.

Comments

0

This happened to me when I tried to install a newer version of PHP. After finding that I also would need to reconfigure Apache for that I switched back to the old PHP version. Here the solution which worked for me:

change the httpd.conf to the correct versions:

 PHPIniDir ...
 LoadModule php5_module ...

Changed the

PATH - Environment Variable

When that does not take any effect

rename or delete the new PHP(-Version)-Folder

For some reason the last step did the trick for me. Even after a restart it did not have an effect before doing this.

Comments

0

If you installed php with homebrew, then check if your apache2.conf file is using homebrew version of php5.so file.

Comments

0

In my case, with Windows Server 2008, I had to change the PATH variable. The former version of PHP (VC9) was inside it.

I have changed it with the newer version of PHP (VC11).

After a restart of Apache, it was okay.

Comments

0
  1. Make shure all your packages have the same php version:

    yum list installed php

  2. Remove 81 packages if you are switching to php8.3

  3. Note that minor packages version also have to match:

    yum list installed php

    php-xml.x86_64 8.3.15-1.red80 @php83

    php83-php-gd.x86_64 8.3.8-1.el7.remi

  4. Find and remove extra repository

    yum repolist

php83

remi

rm /etc/yum.repos.d/remi-*.repo
  1. Reinstall not matching packages

    yum remove php83-php-pecl-igbinary

    dnf install php83-php-pecl-igbinary

or

dnf install php-pecl-igbinary

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.