已移动CakePHP 1.3.8安装映像问题

时间:2018-05-15 19:18:41

标签: php mysql apache cakephp

我试图在服务器之间移动旧的CakePHP 1.3.8安装,并且某些图像无法显示。

旧服务器: Ubuntu 14.04.5 LTS Apache 2.4.7 MySQL 5.5 PHP 5.5.9 PHP(GD,MYSQL)

新服务器: Centos 7.5.1804 Apache 2.4.6 MySQL 5.4 PHP 5.4 PHP(GD,MYSQL)

我已经确认DocumentRoot指向Cake / app / webroot目录,并且在站点配置中有一个AllowOverride All指令。还验证了(3).htaccess文件,mod_rewrite等

调试设置为' 2'在core.php中,但记录的唯一错误是关于图像功能:

imagejpeg() [<a href='http://php.net/function.imagejpeg'>function.imagejpeg</a>]: Filename cannot be empty

每个项目页面上发生的事情的例子 -

Working Site

Non-Working Site

其他一切,包括数据库访问都在起作用。我对cakephp几乎一无所知,但是经历了各种文件,我觉得这个函数是从文件中调用出来的。详细信息是&#39; detail.ctp&#39;在views / projects目录下:

<?php echo $html->image('/App/ContentImageView/'.$image3.'/250/400',array('title'=>'Project Image', 'id'=>'MainImg', 'alt'=>'Project I    mage', 'class'=>'border2')); ?>

来自app_controller.php的函数

function ContentImageView($img_path, $w = '75', $h = '75'){
    Configure::write('debug', 2);
    debug($img_path, $showHTML = true, $showFrom = true);
if (empty($img_path)) return;
    $image = str_replace('@@', '/', $img_path);
    if (empty($image)) return;
    $this->autoLayout = false;
    $this->autoRender = false;
    if(empty($image)) return;
    //image resize parameters
    $FileConfig = array();
    $FileConfig['source_image'] = WWW_ROOT . '/'. $image;
    $FileConfig['dynamic_output'] = true;
    $FileConfig['maintain_ratio'] = true;
    $FileConfig['width'] = $w;
    $FileConfig['height'] = $h;
    ini_set('memory_limit', -1)
    $this->ImageLib->clear();
    $this->ImageLib->set($FileConfig);
    $this->ImageLib->resize()
}

所有代码都可以在旧服务器上完美运行,因此我认为是某种配置路径问题,但我无法指责它。

谢谢大家。

1 个答案:

答案 0 :(得分:0)

我使用PHP 5.3.3设置了Centos 6.9 VM,但问题并不存在。正如ndm指出的那样,必须是PHP的变化。我们不再试图找出代码必须更新的位置,而是继续推进Centos 6.9,因为该网站无论如何都将很快退役。

再次感谢所有回复的人。