使用PHP 5.6加载页面时出现502 Bad Gateway,但使用PHP 7.3加载时,此行返回502 Bad Gateway echo $ application-> handle()-> getcontent() >
PHP版本:5.6.33-0 + deb8u1
已加载的Phalcon:3.4.0
NGINX配置
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?_url=$uri&$args;
disable_symlinks off;
}
location ~ [^/]\.php(/|$) {
# With php5-fpm:
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_hide_header X-Powered-By;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
}
index.php
<?php
try {
//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
APPLICATION_CONTROLLERS,APPLICATION_MODELS,APPLICATION_CORE,APPLICATION_PHALCON_INCUBATOR,APPLICATION_LISTENERS,APPLICATION_TRAITS
))->register();
$loader->registerNamespaces(array(
'Erp\Backend\Models' => APPLICATION_MODELS,'Erp\Backend\Core' => APPLICATION_CORE,'Erp\Backend\Validators' => APPLICATION_VALIDATORS,'Phalcon' => APPLICATION_PHALCON_INCUBATOR,'Erp\Backend\Listeners' => APPLICATION_LISTENERS,'Erp\Backend\Traits' => APPLICATION_TRAITS
),true);
//Create a DI
$di = new Phalcon\DI\FactoryDefault();
$di->set('dispatcher',function () use ($di) {
$dispatcher = new Phalcon\Mvc\Dispatcher();
return $dispatcher;
});
//Setup the view component
$di->set('view',function () {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../application/views/');
return $view;
});
//Handle the request
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getcontent();
} catch (\Phalcon\Exception $e) {
echo 'PhalconException: ',$e->getMessage();
}
无法找出问题所在。有人可以帮我吗?