我被叫来为蛋糕php中的项目进行维护。 客户让项目在他的托管上完美运行,并意外删除了整个内容,然后我被要求重新部署到新的托管中。
我做了标准程序,我将所有文件复制到FTP目录,并修复了与database.php文件和wordpresscomponent.php中的数据库的新连接链接(因为项目与wordpress上的页面集成)在wp-config.php自己的文件夹中运行wordpress中的其他应用程序。
起初,我在网站上发现了相当开放的问题,图片和表单无效。 我意识到我在temp文件夹上缺少权限(在新的FTP新提供程序中上传文件后),然后在内部文件夹核心的temp文件夹和"文件中提供权限755" \ app \ webroot \ files中的文件夹也实现了我的Filezilla损坏的文件和图像上传,然后不得不重做整个上传新文件。该网站已恢复工作。
但是我在管理面板的设计中遇到了问题。 有一个选项卡可以注册类型"产品"和"报纸"这是带有图像的文本(代表网站页面上的产品)。
每当我编辑该页面的信息时,我都会收到本主题中提到的错误。 " 400错误请求
您的浏览器发送了此服务器无法理解的请求。"
更新: 我注意到该错误与产品对象信息中加载的表有关。 如果我编辑产品,并排除此表或创建新产品,则错误显示不同,这似乎只与加载图像的函数有关:
致命错误:Class' imagick'在第829行的/home/serramar.coop.br/public_html/app/Plugin/upload/Model/Behavior/UploadBehavior.php中找不到
#HOSTING SERVER ERROR LOG:
[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity: Access denied with code 400 (phase 2). Pattern match "\\\\%(?!$|\\\\W|[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})" at ARGS:data[Product][nutrition]. [id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]
[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity: Audit log: Failed to lock global mutex: Bad file descriptor [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]
[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity: Audit log: Failed to unlock global mutex: Bad file descriptor [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]
#
/ public_html htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
#
/ public_html / app htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /webroot/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
#
/ public_html / app / webroot htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
#
产品Controller.php在public_html / app / Controller / ProductsController.php
中<?php
App::uses('AppController', 'Controller');
/**
* Products Controller
*
* @property Product $Product
*/
class ProductsController extends AppController {
public function beforeFilter() {
$directory = $this->webroot . 'files' . DS . 'product' . DS . 'picture' . DS;
$this->set('directory', $directory);
$this->set('tabelanutricional', $this->Product->getTabelaNutricional());
return parent::beforeFilter();
}
/**
* Layout
*
* @var string
*/
public $layout = 'bootstrap';
/**
*
*
* @var array
*/
public $helpers = array('TwitterBootstrap.BootstrapHtml', 'TwitterBootstrap.BootstrapForm', 'TwitterBootstrap.BootstrapPaginator');
/**
* Components
*
* @var array
*/
public $components = array('Session');
public function index($line = null){
$this->layout = 'default';
$this->Product->recursive = 0;
$this->redirect('/#produtos');
}
public function serramar(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'serramar')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'Conheça a linha de produtos feitos com o mais delicioso leite das fazendas, um privilégio que você pode ter todos os dias em sua casa');
}
public function maringa(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'maringa')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'A tradição que põe um sabor especial na sua mesa.');
}
public function milkmix(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'milkmix')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'A saborosa bebida láctea da Serramar em novos e deliciosos sabores: ameixa e laranja. Saiba mais!');
}
public function serramar_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'serramar')));
$this->set('products', $products);
$this->set('id', $id);
}
public function milkmix_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'milkmix')));
$this->set('products', $products);
$this->set('id', $id);
}
public function maringa_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'maringa')));
$this->set('products', $products);
$this->set('id', $id);
}
/**
* index method
*
* @return void
*/
public function admin_index() {
$this->Product->recursive = 0;
$this->set('products', $this->paginate());
}
/**
* view method
*
* @param string $id
* @return void
*/
public function admin_view($id = null) {
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
$this->set('product', $this->Product->read(null, $id));
}
/**
* add method
*
* @return void
*/
public function admin_add() {
if ($this->request->is('post')) {
$this->Product->create();
if ($this->Product->save($this->request->data)) {
$this->Session->setFlash(
__('The %s has been saved', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(
__('The %s could not be saved. Please, try again.', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
}
}
}
/**
* edit method
*
* @param string $id
* @return void
*/
public function admin_edit($id = null) {
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->Product->save($this->request->data)) {
$this->Session->setFlash(
__('The %s has been saved', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(
__('The %s could not be saved. Please, try again.', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
}
} else {
$this->request->data = $this->Product->read(null, $id);
}
}
/**
* delete method
*
* @param string $id
* @return void
*/
public function admin_delete($id = null) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
if ($this->Product->delete()) {
$this->Session->setFlash(
__('The %s deleted', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(
__('The %s was not deleted', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
$this->redirect(array('action' => 'index'));
}
}
答案 0 :(得分:1)
问题解决了!!!
再次修复日志后:
[Tue Mar 22 22:30:26 2016] [error] [client 200.100.30.37] ModSecurity: Access denied with code 400 (phase 2). Pattern match "\\\\% ($ | \\\\ W | [0-9a-fA-F] {2} | u [0-9a-fA-F] {4}!)" At ARGS: date [Product] [nutrition]. [Id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/ admin / products / edit / 7"] [unique_id "RjzfCLrtAAIAAMynquEAAABM" ]
[Tue Mar 22 22:30:46 2016] [error] [client 200.100.30.37] ModSecurity: Access denied with code 400 (phase 2). Pattern match "\\\\% ($ | \\\\ W | [0-9a-fA-F] {2} | u [0-9a-fA-F] {4}!)" At ARGS: date [Product] [nutrition]. [Id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/ admin / products / edit / 7"] [unique_id "R3HZ1rrtAAIAAKH1tKEAAABr" ]
我看到他拒绝访问产品营养表,代码:
[产品] [营养] http://i.stack.imgur.com/yg7q3.png
我删除了该表,并尝试再次注册产品并发出此错误:
[Tue Mar 22 22:31:46 2016] [error] [client 200.100.30.37] PHP Fatal error: Class 'imagick' not found in /home/serramar.coop.br/public_html/app/Plugin/upload/Model/ Behavior / UploadBehavior.php on line 829, referer: http://serramar.coop.br/admin/products/edit/7
然后我意识到“想象力”#39; class是每个支持PHP的主机的标准类,我怀疑我的客户端托管不支持php。
我在我拥有的php主机(hostgator)中再次上传整个项目,一切正常,没有错误。
原因:托管不支持php。 解决方案:托管PHP支持的替换。