PHP Defcon is an Extension for PHP to define constants that are available during the whole server runtime - from server start to shutdown.
Overview
With this Extension you have the possebility to define global constants such as configuration constants that will be available during the whole server runtime.
Datatypes
PHP Datatypes
- string
- int
- float
- bool
Datatype Aliases
- long - alias for int
- real - alias for float
- double - alias for float
- logical - alias for bool
- short - alias for int
- boolean - alias for bool
Configuration
# Database Config
string DBHOST = "localhost";
string DBUSER = "root";
string DBPASS = "";
string DBNAME = "test";
# Parsertest
int T1 = 123;
int T2 = 1.3;
int T3 = "test";
real T4 = 1;
string T5 = hello # should work too
logical T6 = true;
logical T7 = false;
logical T8 = 234
Installation
Installing with `pecl` command-line utility
- Execute command "pecl install defcon"
- Make sure you have extension=defcon.so in your php.ini
- Add the configuration lines from above in your /etc/defcon.conf
Installing from sources
- Download defcon source package
- Unpack defcon source package
- Go to defcon folder and type "phpize && ./configure && make && make install"
- Make sure you have extension=defcon.so in your php.ini
- Add the configuration lines from above in your /etc/defcon.conf
Compiling Defcon into PHP
- Download defcon source package
- Unpack defcon source package to $PHP_SOURCE_DIR/ext/defcon
- In php source root directory run commands: "rm configure && ./buildconf --force"
- Configure PHP with command "./configure --with-defcon"
- Run make && make install
- Add the configuration lines from above in your /etc/defcon.conf