简体   繁体   中英

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

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 place 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= .

gd扩展配置文件位于/etc/php5/conf.d/gd.ini :除非我错了,否则/etc/php5/conf.d文件夹中的所有文件都会自动包含在PHP运行时中。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM