d60eba
asked on
Call to undefined function: imagecreate() on Linux system - do I have all the correct components installed?
Hi all,
For a new dedicated server we have moved to I get the following error when trying to use imagecreate():
"Fatal error: Call to undefined function: imagecreate()"
(See here
http://217.112.95.28/player_tools/pt_form_guide.php?id_team=1131&id_league=3)
I initially put this down to the GD library not being installed but
rpm -U gd-2.0.28-4.i386.rpm
exectued from root where that rpm is tells me package gd-2.0.28-4 is already installed. Also php_info():
http://217.112.95.28/php_info.php
tell me php was configured with "with-gd=shared". I'm not sure what this means but I assume it means PHP knows about GD.
Finally I also added the following line to php.ini:
extension=gd.so
I can't think of anything else to do, so I would be grateful if you could have a think for me about why this might not be working.
Many thanks,
Leon Chevalier
For a new dedicated server we have moved to I get the following error when trying to use imagecreate():
"Fatal error: Call to undefined function: imagecreate()"
(See here
http://217.112.95.28/player_tools/pt_form_guide.php?id_team=1131&id_league=3)
I initially put this down to the GD library not being installed but
rpm -U gd-2.0.28-4.i386.rpm
exectued from root where that rpm is tells me package gd-2.0.28-4 is already installed. Also php_info():
http://217.112.95.28/php_info.php
tell me php was configured with "with-gd=shared". I'm not sure what this means but I assume it means PHP knows about GD.
Finally I also added the following line to php.ini:
extension=gd.so
I can't think of anything else to do, so I would be grateful if you could have a think for me about why this might not be working.
Many thanks,
Leon Chevalier
Did your system admin enable GD support for PHP?
./configure --with-gd
You would also need to specify --with-libjpeg-dir and --with-libpng-dir. And they need to be installed.
./configure --with-gd
You would also need to specify --with-libjpeg-dir and --with-libpng-dir. And they need to be installed.
You need to have php built with the "gd" graphics library installed. If you run the phpinfo() command, you'll probably see that "'--with-gd" is not in the "Configure Command" section at the top. You'll have to get your sysadmin to rebuild php with this option.
Rangi
Rangi
Have a look also to http://www.php-faq.com/gdinstall.php
Your configure options already includes all of gd, png and jpeg. You don't need to specify an extension in php.ini on Linux (mine works fine without one). All I can think of is that because you'd specified --with-gd=shared, it was looking for a system installed gd, which may not have been there at compile time. Recompile it with plain --with-gd, and it should pick up PHP's bundled version. While you're at it, you may as well upgrade to PHP 4.3.11 for a bunch of bugfixes.
ASKER
Hi Squinky,
Thanks - I suppose I'll need to recompile then. This would be my first time recompiling (or compiling for that matter) as I have until now used rpm's for installation.
The configure command that I see in my current PHP info is HUGE:
'./configure' '--build=i686-redhat-linux -gnu' '--host=i686-redhat-linux- gnu' '--target=i386-redhat-linu x-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include ' '--libdir=/usr/lib' '--libexecdir=/usr/libexec ' '--localstatedir=/var' '--sharedstatedir=/usr/com ' '--mandir=/usr/share/man' '--infodir=/usr/share/info ' '--cache-file=../config.ca che' '--with-config-file-path=/ etc' '--with-config-file-scan-d ir=/etc/ph p.d' '--enable-force-cgi-redire ct' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimizat ion' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pe ar' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/u sr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mime-magic=/usr/sh are/file/m agic.mime' '--with-apxs2=/usr/sbin/ap xs'
Do I need to repeat this all again? Can I use this with an RPM? That would make my life easier! ;-)
Thanks,
Leon
Thanks - I suppose I'll need to recompile then. This would be my first time recompiling (or compiling for that matter) as I have until now used rpm's for installation.
The configure command that I see in my current PHP info is HUGE:
'./configure' '--build=i686-redhat-linux
Do I need to repeat this all again? Can I use this with an RPM? That would make my life easier! ;-)
Thanks,
Leon
Well, since that's what it used before, it would make sense to use it again to replicate the setup (apart from the gd change). It's not a big deal - you can just paste that lot onto a command line and it will work! All you should need to do is download and untar the PHP source code, cd into the source directory, then paste in that line (perhaps go via an editor to make the changes more easily, you can leave the quotes in place). After it's finished configuring, do 'make', then stop apache ('apachectl stop'), then 'make install' then restart apache ('apachectl startssl'). All there is to it.
PHP has so many options that it's difficult to build an rpm that will suit everyone. I'm pretty sure it's possible to build an rpm from the PHP source that you then install it with rpm, but I've never tried that.
PHP has so many options that it's difficult to build an rpm that will suit everyone. I'm pretty sure it's possible to build an rpm from the PHP source that you then install it with rpm, but I've never tried that.
ASKER
Hi Squinky,
Great - you were right. I pasted in that line and that started the ball rolling. I also needed to install a lot of dependencies (if anyone is having the same problems see this guide: http://www.modem-help.co.uk/help/diary20040402.html)
I have now got as far as a sucessful make install, and this is the result:
[root@server397 php-4.3.11]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/bin/
Installing shared extensions: /usr/lib/20020429/
Installing PEAR environment: /usr/share/pear/
[PEAR] Archive_Tar - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.3.5
Wrote PEAR system config file at: /etc/pear.conf
You may want to add: /usr/share/pear to your php.ini include_path
[PEAR] HTML_Template_IT- already installed: 1.1
[PEAR] Net_UserAgent_Detect- already installed: 2.0.1
[PEAR] XML_RPC - already installed: 1.2.2
Installing build environment: /usr/lib/php/build/
Installing header files: /usr/include/php/
Installing helper programs: /usr/bin/
program: phpize
program: php-config
program: phpextdist
Brilliant! I have looked in /usr/bin and sure enough there's a file named "php" modified today.
However, when I restart Apache everything is just the same as it was!:
http://217.112.95.28/php_info.php
It's still Version 4.3.9 and GD image still doesn't work. Any ideas why this might be? Do I have to tell Apache about the update?
Many thanks,
Leon
Great - you were right. I pasted in that line and that started the ball rolling. I also needed to install a lot of dependencies (if anyone is having the same problems see this guide: http://www.modem-help.co.uk/help/diary20040402.html)
I have now got as far as a sucessful make install, and this is the result:
[root@server397 php-4.3.11]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/bin/
Installing shared extensions: /usr/lib/20020429/
Installing PEAR environment: /usr/share/pear/
[PEAR] Archive_Tar - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.3.5
Wrote PEAR system config file at: /etc/pear.conf
You may want to add: /usr/share/pear to your php.ini include_path
[PEAR] HTML_Template_IT- already installed: 1.1
[PEAR] Net_UserAgent_Detect- already installed: 2.0.1
[PEAR] XML_RPC - already installed: 1.2.2
Installing build environment: /usr/lib/php/build/
Installing header files: /usr/include/php/
Installing helper programs: /usr/bin/
program: phpize
program: php-config
program: phpextdist
Brilliant! I have looked in /usr/bin and sure enough there's a file named "php" modified today.
However, when I restart Apache everything is just the same as it was!:
http://217.112.95.28/php_info.php
It's still Version 4.3.9 and GD image still doesn't work. Any ideas why this might be? Do I have to tell Apache about the update?
Many thanks,
Leon
When you reconfigured it did it as a CGI module.. Your php info shows that it's using the Apache2 handler, so I'd say it didn't actually get your changes...
What version of linux are using, there might be a php rpm package available for your... Worst case I've had pretty good luck in the past solving issues like this by downloading and rebuilding the Src rpm for the php package to build the modules that I couldn't find in a specific rpm package. Overall that's not too bad a process provided you've got all of the devel packages in place that you need. For new versions of redhat its pretty much:
rpmbuild --rebuild php-x.x.x.src.rpm
Then this will end up with a bunch of binary rpms for php in the /usr/src/rehdat/RPMS/i386/ directory
What version of linux are using, there might be a php rpm package available for your... Worst case I've had pretty good luck in the past solving issues like this by downloading and rebuilding the Src rpm for the php package to build the modules that I couldn't find in a specific rpm package. Overall that's not too bad a process provided you've got all of the devel packages in place that you need. For new versions of redhat its pretty much:
rpmbuild --rebuild php-x.x.x.src.rpm
Then this will end up with a bunch of binary rpms for php in the /usr/src/rehdat/RPMS/i386/
ASKER
Hi Systech,
I'm using CentOs 4. This compile of PHP was the first time I've done anything remotely complicated in linux, so unless I have a step-by-step I'm going to find it tricky.
My host has RPMs here:
http://mirror.poundhost.com/centos/centos/4.0/os/i386/CentOS/RPMS/
As you can see they have the php-4.3.9-3.2.i386.rpm RPM. Could this be used to do what you say?
Would there perhaps be an easier way? Can't I just tell Apache to use the CGI module (whatver that is ;-)
Thanks,
Leon
I'm using CentOs 4. This compile of PHP was the first time I've done anything remotely complicated in linux, so unless I have a step-by-step I'm going to find it tricky.
My host has RPMs here:
http://mirror.poundhost.com/centos/centos/4.0/os/i386/CentOS/RPMS/
As you can see they have the php-4.3.9-3.2.i386.rpm RPM. Could this be used to do what you say?
Would there perhaps be an easier way? Can't I just tell Apache to use the CGI module (whatver that is ;-)
Thanks,
Leon
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The Systech I love you and I want to have your children! That worked - I just did what you said and bingo. I am extremely pleased.
Plus, a few notes following this day-long saga:
(1) Linux. Well, what can I say? Never have I experienced such joy in actually managing install something than on Linux. However, I still quake in fear every time the work "compile" is mentioned.
(2) RMPs. Note to self: always have a good look through your provider's RPM repository before attempting the as-yet-never-been-sucessfu lly-comple ted "compile"
Also, thanks Squinky - I'm sure we would have got it working if it hadn't been for the eagle-eyedness of The_Systech. Hence points all round.
Thanks guys,
Leon
p.s I'm sure I'll be back with more installation questions before too long. Be afraid.
Plus, a few notes following this day-long saga:
(1) Linux. Well, what can I say? Never have I experienced such joy in actually managing install something than on Linux. However, I still quake in fear every time the work "compile" is mentioned.
(2) RMPs. Note to self: always have a good look through your provider's RPM repository before attempting the as-yet-never-been-sucessfu
Also, thanks Squinky - I'm sure we would have got it working if it hadn't been for the eagle-eyedness of The_Systech. Hence points all round.
Thanks guys,
Leon
p.s I'm sure I'll be back with more installation questions before too long. Be afraid.
you should see something like that after FTP
gd
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled