Fatal error: Call to undefined function: imagecreate()

后端 未结 8 791
难免孤独
难免孤独 2021-02-06 20:59

I\'m trying to put some graphics on a web page and at my prototype at the computer it\'s all working fine at the localhost. But now I uploaded the files to a server and I\'m hav

相关标签:
8条回答
  • 2021-02-06 21:35

    For Ubuntu 16.04:

    sudo apt-get install php7.0-gd
    

    Stop and then restart Apache Server.

    PS: should first check your current php version

    php -v
    

    In My Case:

    PHP 7.3.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 3 2019 10:00:24) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.5-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

    So, my PHP version is 7.3, so, the command for my version is :

    sudo apt-get install php7.3-gd
    
    0 讨论(0)
  • 2021-02-06 21:37

    for any php version the command for ubuntu installation is

    apt-get install php-gd
    

    it will install the version that matches your php version, and it will be later updated with you php version.

    0 讨论(0)
  • 2021-02-06 21:45

    If you are using a Linux machine then execute this command from console:

    sudo apt-get install php5-gd
    

    to install the php_gd2.dll extension. It will then work after an Apache restart.

    PS: should first check your current php version

    php -v
    

    In My Case:

    PHP 7.3.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 3 2019 10:00:24) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.5-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

    So, my PHP version is 7.3, so, the command for my version is :

    sudo apt-get install php7.3-gd
    
    0 讨论(0)
  • 2021-02-06 21:48

    This means your installation of php doesn't have the gd library installed/enabled.

    http://www.php.net/manual/en/image.installation.php

    0 讨论(0)
  • 2021-02-06 21:48

    Your server most like does not have GD (the built in PHP image processing library) enabled. You can check this by looking for "GD" in the output of :

    <?php
    phpinfo();
    ?>
    

    If not, check the PHP docs on how to enable it: http://www.php.net/manual/en/book.image.php

    0 讨论(0)
  • 2021-02-06 21:50
    1. Copy the file php_gd2.dll from your PHP's ext/ directory to where you have your php extensions. (No need to copy if php_gd2.dll is in the extension dir already. Look in php.ini for 'extension_dir' directive to find what is your current extension directory)

    2. Modify your php.ini and change the following line:

    ;extension=php_gd2.dll

    to:

    extension=php_gd2.dll
    
    0 讨论(0)
提交回复
热议问题