开发者

Unable to find the "extensions" portion of my php.ini file, in apache 2.0, where is it?

开发者 https://www.devze.com 2023-03-04 12:49 出处:网络
I\'m trying to add support for the GD extension on my Ubuntu, Apache 2, php box. However my php.ini file does not seem to be the same as most versions of the INI file and it appears that their are no

I'm trying to add support for the GD extension on my Ubuntu, Apache 2, php box. However my php.ini file does not seem to be the same as most versions of the INI file and it appears that their are no ;extensions comments or a pl开发者_JAVA技巧ace holder for them. Where did this move to? Is their a new location or new method for adding extensions?

I'm at a loss, I only found 2 php.ini files. One for Apache 2 and one for the command line interface.

Ultimately I'm asking this question because the normal fix for the error Undefined offset: 1 in [...]images.php on line 50 Fatal error: Call to undefined function imagecreatefrompng() in [...]functions.php on line 309 does not work.


Most distros, Ubuntu included, generally keep PHP extensions' .ini files in a seperate sub-dir from the main .ini file.

You should have a /etc/php5 directory, with conf.d sub-dir for the main configuration, and apache and cli sub-dirs for the individual versions.

However, Ubuntu has a php5-gd package which will install the extension automatically, so hacking up the .ini files should NOT be necessary, unless you have to compile a specific version of GD yourself.


If there are no extensions in your php.ini, then that's fine. Just because the comments are missing in your .ini file doesn't mean that the "section" has moved; they're just comments!

If you want one, create it.

It starts with the text extension=.


The gd extension configuration file is in /etc/php5/conf.d/gd.ini: unless I'm wrong by default all the files in the /etc/php5/conf.d folder are automatically included in the PHP runtime.


I'm using Ubuntu 14.04 LTS and have the package installed, but Drupal was not detecting it. I looked through the folders and found NOTHING regarding gd save and empty section in the ini files. The error message went away when I manually created the file for the extension in /etc/php5/mods-available. I copied one of the files and changed it to load gd.so, like this:

; configuration for php gd module

; priority=20

extension=gd.so

If you don't have the file either, try that, restart Apache2 and see if it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消