dpcj32769 2009-06-23 19:27
浏览 89
已采纳

想象安装错误 - 类未定义

Okay, Here's a breakdown of what's up:

  1. <? $foo = new Imagick(); ?> works without error when ran from the command-line (e.g., sudo php myscript.php
  2. However, when run via the web browswer I get Fatal error: Class 'Imagick' not found in /var/www/lhackwith_www/test_html/magic.php on line 1.
  3. magickwand is not installed
  4. extension=imagick.so is in imagick.ini which is successfully being read according to phpInfo();
  5. However, imagick is NOT showing up in PHP info.

Any advice would be appreciated.

  • 写回答

4条回答 默认 最新

  • douan3414 2009-06-23 20:10
    关注

    I take it you're absolutely sure you've edited the right php.ini...
    Did you check the webserver's error.log for hints? You might want to increase the LogLevel for that test. If it's an apache see http://httpd.apache.org/docs/2.2/mod/core.html#loglevel and http://httpd.apache.org/docs/2.2/logs.html#errorlog

    or maybe ldd - print shared library dependencies can shed some light on the issue:

    <?php
    $p = get_cfg_var('extension_dir');
    $modpath = $p.DIRECTORY_SEPARATOR.'imagick.so';
    echo $modpath, is_readable($modpath) ? ' readable':' not readable', "<br />
    ";
    echo '<pre>';
    passthru('ldd '.$modpath.' 2>&1'); // in case of spaces et al in the path-argument use escapeshellcmd()
    echo '</pre>';
    please run this script both on the command line and through the webserver. Does it complain about a missing dependency?


    edit2: So the script running "within" the webserver isn't even able to see the extension .so... Let's test at which point of the path the trouble starts
    <?php
    function foo($path) {
      if ( $path==($dir=dirname($path)) ) {
        return;
      }
      foo($dir);
    
    

    echo is_dir($path) ? ' d':' -', is_readable($path) ? 'r':'-', is_writable($path) ? 'w':'-', is_executable($path) ? 'x ':'- ', $path, "<br /> "; }

    $modpath = get_cfg_var('extension_dir').DIRECTORY_SEPARATOR.'imagick.so'; foo($modpath);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序