Tips for PHP Developers

I have 3 different servers with 3 different environment settings (2 Windows servers and 1 Linux server). So every time I moved my files from 1 server to another, it’s broken because database credentials or file systems are different. Therefore, I come up with the environment check before any next logic is in place.

$env_check = getenv(‘windir’);
This line will output ‘C:\WINDOWS’ if your codes are on Windows server. And empty if it’s on Linux.
Now I can use condition to control the different credentials and different directory based on the environment. If 2 Windows servers have 2 different setting, you may want to use another stable variable to check.