Fatal error: Call to undefined function imagecreate()

Discussion in 'PHP' started by AllHostOne.co.uk, May 23, 2011.

  1. #1
    Hi guys , one of my clients is having a issue which you can see at: http://moneyclicker5.co.cc/image.php

    It contains the error: Fatal error: Call to undefined function imagecreate() . I've looked around for a fix with very little help, PHPGD has no download links and the php site that says to do --with comes back saying there is no command . I've put in each php.ini
    ;extension=php_gd2.dll

    I have no idea now how an earth to fix it , im running latest CentOS

    Thanks
     
    AllHostOne.co.uk, May 23, 2011 IP
  2. mobileappdoctor

    mobileappdoctor Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I may be missing something but remove the semicolon in front of the line. Semicolons mean ignore this variable which means if it looks like you listed above the GD library is never loaded.
     
    mobileappdoctor, May 23, 2011 IP
  3. Sefrez

    Sefrez Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It still sounds like PHP GD is not properly being loaded. You should not get a fetal error like that for any other reason than when the function is undefined.

    EDIT:
    Oh, I believe mobileappdoctor is right. Remove the semi colon. The semi colon is telling that line to be ignored.
     
    Sefrez, May 23, 2011 IP
  4. AllHostOne.co.uk

    AllHostOne.co.uk Member

    Messages:
    384
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    45
    #4
    I've just change it so its now
    extension=php_gd2.dll and restarted apche server , no luck
     
    AllHostOne.co.uk, May 23, 2011 IP
  5. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #5
    this is script error, not server
    this error means that the function imagecreate is not yet called in the page.

    to better check define functions in the page

     
    bartolay13, May 24, 2011 IP
  6. AllHostOne.co.uk

    AllHostOne.co.uk Member

    Messages:
    384
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    45
    #6
    Hiya, I've just checked and on line 47 is:
          $image = "imagecreate"($width, $height) or die('Cannot initialize new GD image stream');
    
    Code (markup):
     
    AllHostOne.co.uk, May 24, 2011 IP
  7. mobileappdoctor

    mobileappdoctor Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    There are a couple problems. If that is the exact code you should not have double quotes around the function call to the method but that is not what is causing this specific error.

    Next you mentioned being on CentOS but the loading for extension above is looking for a DLL file which would be windows. I also use CentOS and PHP 5.x and my ini doesn't have the extension referenced in it but I use GD all the time.

    If your using PHP 5 run the following command

    yum install php-gd

    see if that tells you it is already installed.
     
    mobileappdoctor, May 24, 2011 IP
  8. AllHostOne.co.uk

    AllHostOne.co.uk Member

    Messages:
    384
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    45
    #8
    
    Loaded plugins: fastestmirror
    Repository lxlabsupdate is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * openvz-kernel-rhel5: openvz-mirror1.rapidvps.com
     * openvz-utils: openvz-mirror1.rapidvps.com
    addons                                                   |  951 B     00:00
    base                                                     | 2.1 kB     00:00
    extras                                                   | 2.1 kB     00:00
    lxlabslxupdate                                           |  951 B     00:00
    lxlabsupdate                                             |  951 B     00:00
    lxlabsupdate/primary                                     |  62 kB     00:00
    lxlabsupdate                                                            198/198
    openvz-kernel-rhel5                                      |  951 B     00:00
    openvz-utils                                             |  951 B     00:00
    openvz-utils/primary                                     | 2.8 kB     00:00
    openvz-utils                                                                8/8
    update                                                   | 1.9 kB     00:00
    Excluding Packages in global exclude list
    Finished
    Excluding Packages from centos-5-5 - lxlabslxupdates
    Finished
    Excluding Packages from centos-5-5 - lxlabsupdates
    Finished
    Setting up Install Process
    No package php-gd available.
    Nothing to do
    
    Code (markup):
     
    AllHostOne.co.uk, May 24, 2011 IP