亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - slim+nginx訪問報500錯
PHPz
PHPz 2017-05-16 13:15:02
0
2
866

用slim官方的例子創(chuàng)建一個最簡單的slim應(yīng)用,服務(wù)器用的是nginx報錯了。php版本是5.6.30
......1", upstream: "fastcgi://127.0.0.1:9000", host: "test.laonianji.net"
2017/02/08 16:14:14 [error] 26338#0: *6 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /data/www/test_laonianji_net/src/vendor/slim/slim/Slim/Container.php on line 149" while reading response header from upstream, client......

nginx的配置文件用的是官方的,路徑和域名自己修改成正確的了

server {
    listen 80;
    server_name mydomain;
    index index.php;
    error_log /data/log/nginx/access/mydomain.error.log;
    access_log /data/log/nginx/access/mydomain.acess.log;
    root /mypath/src/public;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
    }
}

index.php也是官方的代碼。

<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require '../vendor/autoload.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();
~    
PHPz
PHPz

學習是最好的投資!

全部回復(fù)(2)
PHPzhong

index.php文件最后的那個~是怎么回事?

根據(jù)錯誤提示是php文件語法錯誤。

洪濤

php文件語法錯誤,去查看php的error.log看看
或者把php.ini里面的display_errors打開輸出錯誤

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板