When moving my app to staging i have encountered an issue with auto loading with the following error:
5876#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'App\Config\Config' not found in /var/www/app.com/public/index.php on line 23" while reading response header from upstream, client: xx.xx, server: app.syack.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "app.com"
Environment
- Ubuntu 14.04
- Phalcon 2.0.5 PPA
- Staging: nginx Dev: apache
What I've Tried
- Verified phalcon extension present
- Manually included the class (fails later with other namespaces)
- Double checking nginx config
Index.php
use \App\Config\Config;
use \App\Config\Modules;
use \Phalcon\DI\FactoryDefault;
use \Phalcon\Mvc\Application as BaseApplication;
class Application extends BaseApplication
{
protected function registerServices()
{
$loader = new \Phalcon\Loader();
$loader->registerNamespaces(
array(
"App\Config" => "../app/config/",
)
)->register();
require_once __DIR__ . '../../vendor/autoload.php';
$config = new Config(); \\fail line 23
nginx config
server {
listen 80;
server_name app.com;
index index.php index.html index.htm;
set $root_path '/var/www/app.com/public';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^(.*)$ /index.php?_url=$1;
}
location ~ \.php$ {
# try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index /index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}