PhalconPHP数据库事务在服务器上失败 [英] PhalconPHP Database transactions fail on server

查看:222
本文介绍了PhalconPHP数据库事务在服务器上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用PhalconPHP开发了一个网站.在以下规格的网站上,该网站可以在我的本地计算机上正常运行:

I have developed a website using PhalconPHP. the website works perfectly fine on my local computer with the following specifications:

PHP Version 7.0.22
Apache/2.4.18
PhalconPHP 3.3.1

,以及在我以前的服务器上(使用DirectAdmin):

and also on my previous Server (with DirectAdmin):

PHP Version 5.6.26
Apache 2
PhalconPHP 3.0.1

但是最近我已经迁移到新的VPS.使用cPanel:

But recently I have migrated to a new VPS. with 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

在新的VPS上,我的网站始终会给我Error 500.

On the new VPS my website always gives me Error 500.

在我的Apache错误日志文件中:[cgi:error] End of script output before headers: ea-php70, referer: http://mywebsitedomain.net

in my Apache Error logs file: [cgi:error] End of script output before headers: ea-php70, referer: http://mywebsitedomain.net

我怀疑是新的数据库系统.新的不是mySql.它是MariaDB 10.1.我试图降级到MySQL 5.6,但是WHM表示我无法降级到更低的版本.

What I suspect is the new database System. the new one is not mySql. it is MariaDB 10.1. I tried to downgrade to MySQL 5.6 but the WHM says there is no way I could downgrade to lower versions.

这是我的配置文件:

[database]
adapter  = Mysql
host     = localhost
username = root
password = XXXXXXXXXXXX
dbname   = XXXXXXXXXXXX
charset  = utf8

和我的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);
}

在我的控制器中... 例如,此代码引发Error 500:

And in my controllers... for example this code throws Error 500:

$this->view->files = Patients::query()->orderBy("id ASC")->execute();

但将id更改为fname可解决此问题:

but changing id to fname fixes the problem:

$this->view->files = Patients::query()->orderBy("fname ASC")->execute();

或什至以下代码抛出error 500:

$user = Users::findFirst(array(
                         "conditions" => "id = :id:",
                         "bind" => array("id" => $this->session->get("userID"))
                        ));

PhalconPHP和MariaDB的兼容性是否存在问题?

is there a problem with the compatibility of PhalconPHP and MariaDB?

推荐答案

MariaDB构建为与MySQL客户端主要兼容,这不太可能是造成问题的原因.如果您仍然担心,可以通过转储(导出)表,切换并再次导入它们来从MariaDB切换到MySQL(反之亦然).

MariaDB was built to be mostly compatible with MySQL clients, it's unlikely to be the reason for your problems. If you're still concerned, you can switch from MariaDB to MySQL (and vice versa) by dumping (exporting) your tables, switching over, and importing them again.

更有可能的是,您所显示的错误行指示您的新服务器实际上正在运行PHP7(ea-php70),而不是您所选择的PHP5.6.

More likely, the error line you're showing indicates that your new server is actually running PHP7 (ea-php70) and not PHP5.6 as you thought you selected.

错误End of script output before headers表示CGI脚本(在本例中为PHP7本身)在终止前未产生任何HTTP标头.我怀疑您的PhalconPHP版本与PHP7不兼容,因此会立即崩溃.

The error End of script output before headers means the CGI script (in this case PHP7 itself) did not produce any HTTP headers before terminating. I suspect that your version of PhalconPHP is incompatible with PHP7 and therefore just crashes immediately.

如果cPanel不允许您正确配置基础结构,则您别无选择,只能删除它并手动设置堆栈.但是,由于您可能已经为cPanel付费,因此您可以尝试先向他们打开支持通知单: https://cpanel.com/support /

If cPanel doesn't let you properly configure your infrastructure you likely have no other option but to drop it and set up your stack manually. But since you probably paid for cPanel, you could try opening a support ticket with them first: https://cpanel.com/support/

这篇关于PhalconPHP数据库事务在服务器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆