PhalconPHP Database transactions fail on server(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] 头文件前的脚本输出结束:ea-php70,引用者: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 = 'PhalconDbAdapterPdo\' . $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
:
or even the following code throws 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 数据库事务在服务器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PhalconPHP 数据库事务在服务器上失败
基础教程推荐
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01