Unable to find the "extensions" portion of my php.ini file, in apache 2.0, where is it?
Solution 1
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.
Solution 2
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=
.
Solution 3
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.
Related videos on Youtube
![JustinKaz](https://i.stack.imgur.com/vF20Y.png?s=256&g=1)
JustinKaz
Creative, Writer, Dreamer, Producer, oh... and I code. Fiction: http://www.nefariousactivity.com/category/the-fiction/ I'm also trying to re-write the definition of "Enterprise", making IT look good! http://nafestis.com/ Also: @JustinKaz on twitter, @Justin.kaz on instagram... and I'm not taking over the world. Today. #NefariousActivity
Updated on June 17, 2020Comments
-
JustinKaz about 4 years
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.
-
Femi about 13 yearsMeh, missed that in the body :)
-
-
JustinKaz about 13 yearsAre you sure... the PHP ini file doesn't seem to be the same one I'm used to. It looks different.
-
Lightness Races in Orbit about 13 years@Justin: Please wait while I go invent telepathy. I will then be able to comment on the precise contents of your file.
-
JustinKaz about 13 yearsOk I found the section but, I include extensions=gd.so and I'm still getting the error "undefined function imagecreatefrompng()".
-
JustinKaz about 13 yearsIn webmin the file or folder conf.d is not accessible see image: i.imgur.com/VTnzm.png
-
Marc B about 13 yearsYou could try using the
dl()
function load it dynamically within your script, but that may not be permitted by your host. You may have to call them to get GD enabled. -
JustinKaz about 13 yearsI'm hosting the server... I have the physical box. I could try a terminal session to get access to that file.
-
JustinKaz about 13 yearsI modified the file but did not find the extension file, so I created gd.ini and added extension=gd.so but I still get the error in my question. Any suggestions? Do I have the module gdu.so installed?
-
Marc B about 13 yearsGenerally on ubuntu you'd only have to install the php-gd5 package and restart Apache for it to work.
-
JustinKaz about 13 yearsI can't locate that package? Does it come under another name?
-
Marc B about 13 yearsoops, sorry, brainfart. Should be php5-gd. It's here for 10.10: packages.ubuntu.com/maverick/php/php5-gd