I previously shared my experience using PuPHPet to host a Linux VM on my Windows computer for MEAN stack development. Since then I’ve made some improvements to the startup script I use to overcome Windows’s 260 character path limit, which npm and bower easily exceed.
Lately I’ve been playing with Vagrant and Puppet to create virtual machines for local MEAN stack development. I quickly learned that hosting a Linux VM on a Windows host is tricky. Let’s look at the challenges and workarounds for them.
I’ve always preferred to use relative file paths in my PHP INI, but ran into problems when running PHP from different directories. For example, a directive like
error_log = "../logs/php_errors.log" will resolve to different paths when invoked by
/public/index.php (e.g. Zend Framework) and
/cli-config.php (e.g. Doctrine CLI). Some INI directives can be set at runtime by our application (see PHP_INI_ALL), but many cannot. I finally found the solution with environment variables.
I updated a site to use Single Sign-On (SSO) capability, specifically with Shibboleth, and was shocked to discover that links to the site in Microsoft Office files stopped working. This turns out to be a known issue with no definitive solution. So after thorough troubleshooting I created my own workaround, and as usual I hope sharing it will benefit others.
Most of the websites that I build at work are for internal use, but last year I created a site with a public audience. Everything was going well post-launch until I received a handful of reports from users who couldn’t access the site. They tried clearing cookies, switching browsers, switching computers, and resetting modems, but nothing worked. Visiting any page on the site would result in an error like “Internet Explorer cannot display the webpage” or “Unable to connect”. They could view other sites hosted on my network, but nothing hosted on the same server as this public site. The PHP and server logs recorded nothing unusual. What was happening?
Running PHP sites on Internet Information Services (IIS) is easy! And with a few extra steps, you can achieve a versatile and extensible setup to avoid management headaches down the line. Follow this guide to add PHP functionality to your IIS server and avoid common mistakes.