Agh*_*gha 12 php mysql cpanel mariadb phalcon
我使用PhalconPHP开发了一个网站.该网站在我的本地计算机上运行良好,具有以下规格:
PHP Version 7.0.22
Apache/2.4.18
PhalconPHP 3.3.1
Run Code Online (Sandbox Code Playgroud)
以及我以前的服务器(使用DirectAdmin):
PHP Version 5.6.26
Apache 2
PhalconPHP 3.0.1
Run Code Online (Sandbox Code Playgroud)
但最近我已迁移到新的VPS.与cPanel:
CENTOS 7.4 vmware [server]
cPanel v68.0.30
PHP Version 5.6.34 (multiple versions available, this one selected by myself)
PhalconPHP 3.2.2
Run Code Online (Sandbox Code Playgroud)
在新的VPS上我的网站总是给我Error 500.
在我的Apache错误日志文件中: [cgi:error] End of script output before headers: ea-php70, referer: http://mywebsitedomain.net
我怀疑是新的数据库系统.新的不是mySql.它是MariaDB 10.1.我试图降级到MySQL 5.6,但是WHM说我无法降级到更低版本.
这是我的配置文件:
[database]
adapter = Mysql
host = localhost
username = root
password = XXXXXXXXXXXX
dbname = XXXXXXXXXXXX
charset = utf8
Run Code Online (Sandbox Code Playgroud)
和我的Services.php:
protected function initDb()
{
$config = $this->get('config')->get('database')->toArray();
$dbClass = 'Phalcon\Db\Adapter\Pdo\\' . $config['adapter'];
unset($config['adapter']);
return new $dbClass($config);
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器中...例如这段代码抛出Error 500:
$this->view->files = Patients::query()->orderBy("id ASC")->execute();
Run Code Online (Sandbox Code Playgroud)
但改变id以fname解决问题:
$this->view->files = Patients::query()->orderBy("fname ASC")->execute();
Run Code Online (Sandbox Code Playgroud)
甚至以下代码抛出error 500:
$user = Users::findFirst(array(
"conditions" => "id = :id:",
"bind" => array("id" => $this->session->get("userID"))
));
Run Code Online (Sandbox Code Playgroud)
PhalconPHP和MariaDB的兼容性有问题吗?
MariaDB的构建主要与MySQL客户端兼容,不太可能是您遇到问题的原因.如果您仍然担心,可以通过转储(导出)表,切换并再次导入它们,从MariaDB切换到MySQL(反之亦然).
更有可能的是,您显示的错误行表明您的新服务器实际上正在运行PHP7(ea-php70)而不是您认为您选择的PHP5.6.
该错误End of script output before headers意味着CGI脚本(在本例中为PHP7本身)在终止之前不生成任何HTTP头.我怀疑你的PhalconPHP版本与PHP7不兼容,因此只是立即崩溃.
如果cPanel不允许您正确配置您的基础架构,您可能没有其他选择,只能删除它并手动设置堆栈.但是既然您可能已经支付了cPanel,您可以先尝试打开支持票:https://cpanel.com/support/