Hi, guys:
I am a newer to using slim framework 4. I use centos7 and nginx and php-fpm 7.3.
Here are my index.php
and return
Notice : Undefined variable: app in /usr/share/nginx/html/slim4/vendor/index.php on line 9
Fatal error : Uncaught Error: Call to a member function get() on null in /usr/share/nginx/html/slim4/vendor/index.php:9 Stack trace: #0 {main} thrown in /usr/share/nginx/html/slim4/vendor/index.php on line 9
but when I use
php -S localhost:9500 index.php
it is ok, what’s wrong with me ? thanks
I want use http://x.x.x.x:9500/slim4
here my nginx.conf
location /slim4 {
alias /usr/share/nginx/html/slim4/public;
index index.php;
}
location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# try_files $uri=404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
# fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/slim4/public$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}