1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved enable GD extension in linux php

Discussion in 'Development' started by KHAV, May 23, 2018.

  1. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    So how i can enable GD extension in linux php? I tried php-build-scripts but it didn't work.

    .
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    What did you try and how did that not work?
     
  3. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    i want to run this code:
    PHP:
    $folder $this->getDataFolder()."Image/";
    $colores = [];
    $imagen = @imagecreatefrompng($folder."Rules.png");
    if (
    $imagen === false) {
        
    $sender->sendMessage(T::RED."Error with image!");
        return 
    true;
    }
    $r 0;
    $g 0;
    $b 0;
    $ancho 128;
    $altura 128;
    $imagen imagescale($imagen$ancho$alturaIMG_NEAREST_NEIGHBOUR);
    imagepng($imagen$folder "Rules-new.png");
    for (
    $y 0$y $altura; ++$y) {
        for (
    $x 0$x $ancho; ++$x) {
            
    $rgb imagecolorat($imagen$x$y);
            
    $color imagecolorsforindex($imagen$rgb);
            
    $r $color["red"];
            
    $g $color["green"];
            
    $b $color["blue"];
            
    $colores[$y][$x] = new Color($r$g$b0xff);
        }
    }
    $map Item::get(Item::FILLED_MAP);
    $map->setCustomName("§cRules");
    $sender->getInventory()->remove($map);
    $map Item::get(Item::FILLED_MAP);
    $map->setCount(1);
    $key 18293883;
    $tag = new CompoundTag("", []);
    $tag->setString("map_uuid"$key);
    $map->setCompoundTag($tag);
    $map->setCustomName("§cRules");
    $sender->getInventory()->setItem(3$map);
    i think it works but because the gd extension is disable it doesn't work, so i think i should run it with gd extension, if you can please tell me how?
     
  4. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Anyone can help? I need this very necessary.
     
  5. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    The more information you provide, the more likely you'll get an answer, and so far you didn't actually answer Muqsit's question, so we have no way of knowing what's going on.

    Do you have the console output of the php build script that "didn't work"? When you run "/path/to/your/pmmp/php/bin/php -m" what do you see? What error does your script show?
     
    Last edited: May 25, 2018
    Muqsit likes this.
  6. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    This:
    PHP:
    Last failed loginThu May 24 14:27:00 CEST 2018 from 58.242.83.42 on ssh:notty
    There were 4168 failed login attempts since the last successful login
    .
    Last loginThu May 24 07:33:17 2018 from 151.64.100.7
    [root@minetest ~]# cd /home
    [root@minetest home]# cd minecraf
    -bashcdminecrafNo such file or directory
    [root@minetest home]# cd minecraft
    [root@minetest minecraft]# cd multicraft
    [root@minetest multicraft]# cd jar
    [root@minetest jar]# cs pocket
    -bashcscommand not found
    [root@minetest jar]# cd pocket
    [root@minetest pocket]# /bin/php - m
    PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
    Could not open input file
    : -
    [
    root@minetest pocket]# /bin/php -m
    PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
    [PHP Modules]
    bcmath
    bz2
    calendar
    Core
    ctype
    curl
    date
    dom
    ereg
    exif
    fileinfo
    filter
    ftp
    gd
    gettext
    gmp
    hash
    iconv
    json
    ldap
    libxml
    mbstring
    mhash
    mysql
    mysqli
    odbc
    openssl
    pcntl
    pcre
    PDO
    pdo_mysql
    PDO_ODBC
    pdo_sqlite
    Phar
    posix
    readline
    Reflection
    session
    shmop
    SimpleXML
    sockets
    SPL
    sqlite3
    standard
    sysvmsg
    sysvsem
    sysvshm
    tokenizer
    wddx
    xml
    xmlreader
    xmlrpc
    xmlwriter
    xsl
    zip
    zlib

    [Zend Modules]

    [
    root@minetest pocket]#
     
    Muqsit likes this.
  7. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Great, you can see the gd extension is listed so that's not the problem... Now what error does your script give?
     
  8. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Ummm, what i should do next?
     
  9. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Post your code, and post the error message!
     
  10. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    This is the code:
    And the error:
    Code:
     27.05 22:34:02 [Server] Server thread/CRITICAL Error: "Call to undefined function MapsPic\imagecreatefrompng()" (EXCEPTION) in "MapsPic/src/MapsPic/Main" at line 33
     
  11. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    You need to install libpng-dev
    PHP:
    //Ubuntu/Debian
    apt-get install libpng-dev

    //CentOS
    yum install libpng-dev
    And then compile php with libpng.
    Code:
    --with-gd \
    --with-png-dir \
    
     
    Awzaw likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.