PHP extensions not loading in phpinfo

只谈情不闲聊 提交于 2019-12-06 00:43:50

问题


So I'm running MAMP on Mountain Lion and I've installed gmagick and imagick using pecl, both are relase candidates (mainly because gmagick doesn't have a stable release and imagick 3.0.0 doesn't install, it gives a make error). The modules appear when I run php -i in the terminal but not in phpinfo(), I have checked the php.ini it is the same for both so that is not the issue.However I have installed bitset(which is a stable release) and it appears in phpinfo() and php -i. So my question is does PHP have any configuration option that does not load extensions if they are not stable? Btw, I did restart my server after the changes to the ini file.


回答1:


You will probably now have two php installations on your machine. Mountain Lion ships with a preinstalled php version. Trylocate php.ini in Terminal to find out how many php.inis are installed.

In your phpinfo() page there is also noted which php.ini is in use. You might want to open the exact php.ini which is used for your phpinfo() and make sure the extentions are loaded. There should be two lines like extension=/path/to/gemagicext/gmagic.so extension=/path/to/imagick/imagick.so




回答2:


I faced a similar problem with php-fpm and nginx server. The problem was due to the fact that the updated php configuration was not reflected in the current active php-fpm worker processes. I have to manually kill the fpm process and restart it again to have the updated extensions info.

Steps that worked for me:

1) Look for active php-fpm process

 ps ax | grep "fpm"

mostly this will list more than one process

2) kill process manually

kill -9 [pid_got_from_previous_command]

3) restart php-fpm process

sudo service php5-fpm start

Note: Trying something like sudo service php-fpm reload or sudo service php-fpm restart didn't work since the old child processes retained the old configuration. Killing the active processes and restarting php fpm what updated the phpinfo for me.




回答3:


I had the same problem CentOS 6.6 x64, php 5.5.27 and I followed the steps from http://php.net/manual/en/imagick.installation.php

First of all download a tar image of the ImageMagick install from here: sourceforge.net/projects/imagemagick/files/

Unpack it and then from terminal issue the following commands:

1.  "cd ImageMagick-6.9.1-10" - go where you placed the folder
2.  ./configure
3.  make
4.  make install
5. make check
6. install imagick extension from pecl.php.net/package/imagick/download 3.1.2
7. cd imagick-3.1.2
8. phpize
9. ./configure --with-imagick=/opt/local
10. make
11. make install
12. Copy imagick.so in your PHP extensions folder and add extension=imagick.so in php.ini

Restart apache: service httpd restart




回答4:


I am sure this problem is related to your extension and PHP server compatibility. I encountered such problems when I created my own extensions. Your extension should compatible with your PHP server in three main attributes:

1- The Zend API number which your PHP server is configured with ( in phpinfo() you can find this number), this number should be the same with your extension header file at build time.

2- The compiler version on your PHP server and your extension must be the same.

3- Thread safety in your PHP server is important. If you use thread-safe server then your extension must be built with php thread-safe library and if you use non-thread safe server you should build your extension with PHP-nts library.



来源:https://stackoverflow.com/questions/15271943/php-extensions-not-loading-in-phpinfo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!