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-开发者_JS百科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!
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
try to upgrade each of those modules using pecl command
# pecl upgrade fileinfo
# pecl upgrade memcache
# pecl upgrade mhash
# pecl upgrade readline
etc...
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)
Erase the module that can't be initialized and reinstall it.
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.
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.
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.
If you installed php with homebrew, then check if your apache2.conf file is using homebrew version of php5.so file.
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.
精彩评论