Jump to content


PHP_SAPI returning different values

PHP_SAPI cronjob cron cli cgi-fcgi bat batch

  • Please log in to reply
No replies to this topic

#1 MarcusDavis



  • Member
  • Pip
  • 1 posts
  • Main OS: Windows 7

Posted 01 October 2015 - 06:12 AM

Hi and thanks for reading.


I have UniserverZ XI working with php 5.5 perfectly for my requirements.  Now I want to use a .bat file to perform a Cronjob within my system.


The script requires correct settings for PHP_SAPI like this:


...if(PHP_SAPI === "cli"...



When I perform echo(PHP_SAPI."\n"); in my script to check what kind of PHP_SAPI the server is using, I get different results:


cgi-fcgi when the script is run directly from the browser and "cli" when opened through a .bat file (cronjob).


anyway, executing the script with: php -f cron.php from the server console isn't performing the script, nor giving me an error.


my only success has been opening the script directly from the browser with PHP_SAPI set to cgi-fcgi.


How is this possible and how can I make it work from the bat file too?


Any help would be appreciated.
Thank you!




Also tagged with one or more of these keywords: PHP_SAPI, cronjob, cron, cli, cgi-fcgi, bat, batch

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users