Reputation: 283313
From PHP, how can I check if my server was started with something like:
php -S localhost:8080 -t public index.php
? I need some special logic to serve static files during development. Nginx won't need this code, so I want to put in a check.
Upvotes: 1
Views: 240
Reputation:
By calling php_sapi_name()
. It'll return "cli-server"
when running under the built-in server, and another value (probably "cgi-fcgi"
or "fpm-fcgi"
, depending on your setup) when running from nginx.
Upvotes: 2