SAPI Globals (SG)

Author Topic: SAPI Globals (SG)  (Read 300 times)

Offline beingchinmayTopic starter

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 0
  • Posts: 33
  • Karma: 0
  • Gender: Male
  • I am Chinmay
    • Fat Cutter
SAPI Globals (SG)
« on: 08-10-2016, 04:40:58 »
SAPI is the Server Abstraction API. It contains any variables related to the web server under which PHP is running. Note that not all SAPI modules are related to web servers. The command-line version of PHP, for example, uses the CGI SAPI layer. There is also a Java SAPI module. You can check which SAPI module you are running under by including SAPI.h and then checking

#include <SAPI.h>
/* then in a function */
printf("the SAPI module is %s\n",;

See the sapi_globals_struct in the main/SAPI.h file for a list of available SAPI globals. For example, to access the default_mimetype SAPI global, you would use:


Some elements of the SAPI globals structure are themselves structures with fields. For example, to access the request_uri, use: