Verify ImageMagick installation

前端 未结 10 1485
一个人的身影
一个人的身影 2020-11-29 01:16

My web hosting said ImageMagic has been pre-installed on the server. I did a quick search for \"ImageMagick\" in the output of phpinfo() and I found nothing. I can\'t SSH in

相关标签:
10条回答
  • 2020-11-29 01:36

    Remember that after installing Imagick (or indeed any PHP module) you need to restart your web server and/or php-fpm if you're using it, for the module to appear in phpinfo().

    0 讨论(0)
  • 2020-11-29 01:43

    In Bash you can check if Imagick is an installed module:

    $ php -m | grep imagick
    

    If the response is blank it is not installed.

    0 讨论(0)
  • 2020-11-29 01:44

    If your ISP/hosting service has installed ImageMagick and put its location in the PATH environment variable, you can find what versions are installed and where using:

    <?php
    echo "<pre>";
    system("type -a convert");  
    echo "</pre>";
    ?> 
    
    0 讨论(0)
  • 2020-11-29 01:46

    Try this one-shot solution that should figure out where ImageMagick is, if you have access to it...

    This found all versions on my Godaddy hosting.

    Upload this file to your server and call it ImageMagick.php or something then run it. You will get all the info you need... hopefully...

    Good luck.

    <?
    /*
    // This file will run a test on your server to determine the location and versions of ImageMagick. 
    //It will look in the most commonly found locations. The last two are where most popular hosts (including "Godaddy") install ImageMagick.
    //
    // Upload this script to your server and run it for a breakdown of where ImageMagick is.
    //
    */
    echo '<h2>Test for versions and locations of ImageMagick</h2>';
    echo '<b>Path: </b> convert<br>';
    
    function alist ($array) {  //This function prints a text array as an html list.
        $alist = "<ul>";
        for ($i = 0; $i < sizeof($array); $i++) {
            $alist .= "<li>$array[$i]";
        }
        $alist .= "</ul>";
        return $alist;
    }
    
    exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
    echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
    echo alist($out); //Print the output of "convert -version"
    echo '<br>';
    echo '<b>This should test for ImageMagick version 5.x</b><br>';
    echo '<b>Path: </b> /usr/bin/convert<br>';
    
    exec("/usr/bin/convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
    echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
    echo alist($out); //Print the output of "convert -version"
    
    echo '<br>';
    echo '<b>This should test for ImageMagick version 6.x</b><br>';
    echo '<b>Path: </b> /usr/local/bin/convert<br>';
    
    exec("/usr/local/bin/convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
    echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
    echo alist($out); //Print the output of "convert -version";
    
    ?>
    
    0 讨论(0)
提交回复
热议问题