Wiki

Clone wiki

Server2Go / Server2Go_environment_variables_that_can_accessed_via_PHP

Environment variables

Because you can start Server2Go from every path you want, you can get different paths and environment settings at every startup (i.e. different CD-ROM drive-names). For this reason Server2Go is setting some environment variables at startup. The usage of the environment variable can be pretty handy if you need hardcoded absolut pathes in config files of a webapplication

You can access this variables via PHP using the $_ENV array, like in the example below

<?php
  echo $_ENV["S2G_SERVER_DOCROOT"];
?>

Available settings

NameDescription
S2G_SERVER_DOCROOTThe absolute path to the htdocs folder of the current server2go application (i.e. d:\cdrom\htdocs)
S2G_SERVER_SOFTWAREA string with version information of Server2Go (i.e. Server2Go 1.4.4
S2G_SERVER_APPROOTThe absolute path of the root folder of the server2go installation (i.e. d:\cdrom)
S2G_EDITIONShows the installed parts of Server2Go (i.e. PSMP which means PHP/SQLite/MySQL/Perl)
S2G_DB_PATHThe path to that all database files are written (the path you set in the server2go config
S2G_TEMP_FOLDERThe path where Server2Go writes all temporary files (i.e. config files)
S2G_MYSQL_PORTThe port of the started mysql instance (V.1.5.0 and higher)
S2G_APACHE_PORTThe port of the startetd apache instance (V.1.5.0 and higher)
S2G_BASE_URLThe base URL of the started Server2Go instance (i.e. http://127.0.0.1:4001) (V.1.5.0 and higher)

Updated