I have a development platform with a development server and a production server. I'll upload my projects to both servers, but I want exceptions to be handled differently on development servers. Because I want to be able to upload the exact same code to both servers, I want php to detect which server it is running on and act accordingly. I thought this would be an easy task but it isn't.
So far I tried the following:
Setting an environment variable in /etc/profile and reading it using php's getenv function.
Didn't work because from php you can only read a couple of environment variables, and not those in etc/profile.
Getting the server address and/or host using the $_SERVER superglobal.
Didn't work for crons.
Setting a custom non-standard setting (error_message_mode) in php.ini.
Didn't work because only standard settings will be available in ini_get.
Getting the ip address of the server using some linux function.
I frankly don't know how to do this. Any ideas?
How can I do this in a simple way?