我正在尝试在服务器之间移动旧的 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等。
在 core.php 中调试设置为“2”,但记录的唯一错误与图像函数有关:
imagejpeg() [<a href='http://php.net/function.imagejpeg'>function.imagejpeg</a>]: Filename cannot be empty
每个项目页面上发生的情况的示例-
其他一切(包括数据库访问)都正常。我对 cakephp 几乎一无所知,但浏览了各个文件,在我看来,这个函数是从views/projects 目录下的文件“detail.ctp”调用的:
<?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()
}
所有代码在旧服务器上都能完美运行,所以我认为是某种配置路径问题,但我就是无法确定它。
谢谢大家。
最佳答案
我使用 PHP 5.3.3 设置了 Centos 6.9 VM,但不存在该问题。正如 ndm 指出的那样,必须是 PHP 的更改。我们不是试图找出必须更新代码的地方,而是在 Centos 6.9 上继续前进,因为无论如何这个网站很快就会退役。
再次感谢所有回复的人。
关于php - 移动 CakePHP 1.3.8 安装镜像问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50357718/