View Full Version : PHP error
I have a auction script that has an error.
Here is the error:
Fatal error: Call to undefined function ImageFontWidth() in /home/user/public_html/includes/functions.php on line 28And a extract functions.php ( Line 28 is pink):
function show_pin_image ($full_pin, $generated_pin, $image_url = '')
{
## create an image not a text for the pin
$font = 6;
$width = ImageFontWidth(6) * strlen($generated_pin);
$height = ImageFontHeight(6);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 219, 239, 249); //cell background
$text_color = imagecolorallocate ($im, 0, 0,0);//text color
imagestring ($im, $font, 0, 0, $generated_pin, $text_color);
touch($image_url . 'uplimg/site_pin_' . $full_pin . '.jpg');
imagejpeg($im, $image_url . 'uplimg/site_pin_' . $full_pin . '.jpg');
$image_output = '<img src="' . $image_url . 'uplimg/site_pin_' . $full_pin . '.jpg">';
imagedestroy($im);
return $image_output;
}
I can't fix it :(
Can you?
Thanks.
Jack,
make sure you have GD installed.
Graphics Library? Ah i can enable it in WHM
Yep you don't have GD installed, or it doesn't like the capitisation.
Try changing it to imagefontwidth not ImageFontWidth, same with height.
mm, Can't find it in WHM.
[~]# php -m [PHP Modules] bcmath calendar ctype curl date dom filter ftp hash iconv imap ionCube Loader json libxml mysql openssl pcre posix Reflection session SimpleXML sockets SPL SQLite standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules] the ionCube PHP Loader Not there aswell?
Lorem-Ipsum
28-11-10, 21:25
yum install php-gd ?
yum install php-gd ?
Did it 5 mins ago. "Nothing to do"
Lorem-Ipsum
28-11-10, 21:29
Could you post the output of
cat /etc/yum.repos.d
"cat: /etc/yum.repos.d: Is a directory"
Lorem-Ipsum
28-11-10, 21:39
lols, whoops
I'm not very good with rpm/yum based distros.
basically there will be a file somewhere with an exclude list with
php* in it which you have to remove to install php packages.
EDIT: Think I've got it.
Give
cat /etc/yum.conf a whirl
In that folder i have 2 files:
CentOS-Base.repo
&
CentOS-Media.repo
Lorem-Ipsum
28-11-10, 21:43
Read my last post mate.
Removed both... Still "nothing to do"
Lorem-Ipsum
28-11-10, 21:47
Give
cat /etc/yum.conf a whirl
Could you post the output.
[~]# cat /etc/yum.conf
[main]
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
installonlypkgs=kernel kernel-smp kernel-devel kernel-smp-devel kernel-largesmp kernel-largesmp-devel kernel-hugemem kernel-hugemem-devel
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
plugins=1
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
You should try:
yum install php5-gd
EDIT: Remove php* from your package excludes list.
Lorem-Ipsum
28-11-10, 21:54
lols, whoops
I'm not very good with rpm/yum based distros.
basically there will be a file somewhere with an exclude list with
php* in it which you have to remove to install php packages.
EDIT: Think I've got it.
Give
cat /etc/yum.conf a whirl
[~]# cat /etc/yum.conf
[main]
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
installonlypkgs=kernel kernel-smp kernel-devel kernel-smp-devel kernel-largesmp kernel-largesmp-devel kernel-hugemem kernel-hugemem-devel
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
plugins=1
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
Erm. Read much?
Use your prefered editor to edit the file to remove php* .
I recommend nano, so
nano /etc/yum.conf
Removed *php but still "nothing to do"
Lorem-Ipsum
28-11-10, 22:00
You should try:
yum install php5-gdEDIT: Remove php* from your package excludes list.
Tried this^
Yer thats the one i tried.
Notice it says php5-gd not php-gd.
If you've tried both, then try this:
yum install php-gd.i386
yum install php5-gd.i386
Yer i tried them all.
Your new ones also don't work :(
Lorem-Ipsum
28-11-10, 22:15
Could you post the output of
cat /etc/yum.conf just to be sure.
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
installonlypkgs=kernel kernel-smp kernel-devel kernel-smp-devel kernel-largesmp kernel-largesmp-devel kernel-hugemem kernel-hugemem-devel
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
plugins=1
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
oooo, Just tried:
root@www [~]# yum install php-gd
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Excluding Packages in global exclude list
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-gd to pack into transaction set.
php-gd-4.3.9-3.29.i386.rp 100% |=========================| 21 kB 00:00
---> Package php-gd.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: php = 4.3.9-3.29 for package: php-gd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
php-4.3.9-3.29.i386.rpm 100% |=========================| 26 kB 00:00
---> Package php.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: php-pear for package: php
--> Processing Dependency: httpd-mmn = 20020903 for package: php
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-pear to pack into transaction set.
php-pear-4.3.9-3.29.i386. 100% |=========================| 47 kB 00:00
---> Package php-pear.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: httpd-mmn = 20020903 for package: php
--> Finished Dependency Resolution
Error: Missing Dependency: httpd-mmn = 20020903 is needed by package php
Lorem-Ipsum
28-11-10, 22:35
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
installonlypkgs=kernel kernel-smp kernel-devel kernel-smp-devel kernel-largesmp kernel-largesmp-devel kernel-hugemem kernel-hugemem-devel
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
plugins=1
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
oooo, Just tried:
root@www [~]# yum install php-gd
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Excluding Packages in global exclude list
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-gd to pack into transaction set.
php-gd-4.3.9-3.29.i386.rp 100% |=========================| 21 kB 00:00
---> Package php-gd.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: php = 4.3.9-3.29 for package: php-gd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
php-4.3.9-3.29.i386.rpm 100% |=========================| 26 kB 00:00
---> Package php.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: php-pear for package: php
--> Processing Dependency: httpd-mmn = 20020903 for package: php
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-pear to pack into transaction set.
php-pear-4.3.9-3.29.i386. 100% |=========================| 47 kB 00:00
---> Package php-pear.i386 0:4.3.9-3.29 set to be updated
--> Running transaction check
--> Processing Dependency: httpd-mmn = 20020903 for package: php
--> Finished Dependency Resolution
Error: Missing Dependency: httpd-mmn = 20020903 is needed by package php
Now try removing
httpd* from /etc/yum.conf
and try again.
YAY,
Removed them all. WORKED!
Thank yu all for your help!
Now just got to fix the script :rolleyes:
+1 to all (Lorem-Ipsum (http://forums.aria.co.uk/member.php?u=14673), Need to spreed some out before i can +1 you again )
Lorem-Ipsum
28-11-10, 22:47
Cool, glad you got it working.
I really don't know why they try to stop you installing and updating packages in CentOS. Maybe its for stability reasons. Bit wierd really.
Well it works now :)
Added after 8 minutes:
Problem!!!!
Can't get on any PHP page now.
Well my Billing sytem is down as well as my script.
Lorem-Ipsum
28-11-10, 23:23
have you tried restarting apache? / rebooting?
Ah, Ill do that :thumb:
Added after 4 minutes:
Nope, din't work :(
Lorem-Ipsum
28-11-10, 23:51
I'm shattered and need to get some sleep.
I suggest you try the CentOS forums as they will be able to give you better help.
Make sure you post exactly what you did.
Sorry I can't help more.
Sorry I can't help more.
You have done more than i could hope for. Thank you anyway.
Cpanel are going to have a look later on tomorrow for me.
Check your apache and PHP error logs.
Open your php.ini file and check the error_log directive to see where the PHP log is, apache one should be in the apache folder.
guesswork shot in the dark, force apache to recompile with the new use flags
guesswork shot in the dark, force apache to recompile with the new use flags
He's using yum so presumably he's just using packages and didn't actually compile apache or php himself.
Apparently i should have done it via Easyapache.
All Fixed! Cpanel basically built EasyApache again.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.