在我的蛋糕PHP v2.*中,我有一个完全工作的应用程序,它可以在/app/webroot/lib/upload/process.php
中对文件进行ajax发布
我现在将站点移动到新服务器,并在对同一文件进行 ajax 发布时出现缺少控制器错误。所以我的第一个想法是,不知何故mod_rewrite
没有配置......但最奇怪的是,当我从浏览器访问文件时,没有显示任何错误。所以只有 ajax 调用
顺便说一句。我正在使用ISPConfig作为管理控制台在Ubuntu 14.04服务器上运行该网站
我得到的错误是:
Missing Controller
Error: LibController could not be found.
Error: Create the class LibController below in file: app/Controller/LibController.php
ajax 脚本是:
$('#my-upload-form').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
其中表格是:
<form action="/lib/upload/process.php" method="post" enctype="multipart/form-data" id="my-upload-form">
安慰:
Request URL:https://www.bukadoo.com/lib/upload/process.php
Request Method:POST
Status Code:404 Not Found
Remote Address:52.37.22.4:443
根目录中的 .htaccess :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
文件夹中webroot
.htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
最后,这是一个服务器问题。在完全不同的服务器上安装应用程序后,一切正常。
经过长时间的搜索,我发现我需要将ISPConfig中的设置从Fast-CGI
设置为Mod-PHP