Developing PHP applications which support a variety of servers and environments requires me to occasionally develop on Windows. The first thing someone notice when switching from Linux or macOS to a Windows machine for PHP development is that it’s so darned slow. Even on the exact same machine, Linux is a good 2x to 5x faster than Windows. Most of the sluggishness observer, however, is down to configuration and can be mitigated. This article explains some of the tricks I used to make PHP faster on my Windows development machines.
We can all agree that taking backups is important. We also agree that backups on the same medium as the backed up content are as good as no backup at all. This has led a lot of us to store our backups to the cloud, predominantly on cheap Amazon S3 storage. But how can we make sure that should the content server be compromised our backups will not be abused or deleted?
Amazon Web Services (AWS) offers a wealth of services for site owners. A service I particularly enjoy is the inexpensive CloudFront CDN which lets me deliver static content, like downloads and update information for my software, very fast to people across the world. What became apparent is that while it was fast and cheap, it wasn’t the most secure solution. Anyone could forge the update response and mislead my users to downloading a modified package full of malware. The solution was to use an SSL certificate with the CDN, ensuring the integrity of the downloads and update information. For this purpose I used Let’s Encrypt™ which allows you to create properly singed SSL certificates for free. The process is non-obvious so I’m documenting this for you.
I regularly have the need to try things out on Linux. Sometimes a virtual machine won’t cut it for me typically due to memory, disk and performance limitations. Moreover, a decent, up-to-date, bootable Linux environment is a great backup in case all of my other computers are broken, infected or stolen. That entails having the Linux installation on an external, USB-attached hard disk drive which can boot with relative ease on any UEFI-enabled PC (driver compatibility notwithstanding). Moreover, all the preparatory work has to be performed using a single-boot Windows computer without ending up having a dual boot system. It sounds tough. It is tough, but I’m writing this from my portable Ubuntu Linux installation running off a USB-attached SSD!
If you want to use SSH or SFTP with PHP you need the SSH2 extension. Unfortunately MAMP doesn’t come with it out of the box. Last year I had written about how to add the SSH2 extension to MAMP, on PHP 5.6. In the meantime two major changes ocurred which pretty much nullified the process: OS X El Capitan was released requiring new prerequisites to be installed and PHP 7 was included which requires an entirely new approach to installing SSH2 (it’s no longer as simple as using pecl). In this article we’ll discuss the process required to get the SSH2 extension installed on PHP7 in MAMP.
If you want to start developing PHP applications, or merely work on your PHP-based site off-line, on Mac OS X you can easily do so. In this how-to we’ll see how you can set up NginX, a high performance web server, with the PHP version shipped with Mac OS X itself to create a local web server. In case you’re wondering, you can of course use it in parallel with MAMP, XAMPP or even the multi-PHP version server I’ve described in an earlier post.
I am the happy owner of an Intel NUC dual booting Windows 8.1 and Ubuntu, hooked up to a great-looking Apple LED Cinema Display. The only problem is that the Apple display comes with no physical controls for brightness and Ubuntu doesn’t seem to be able to adjust it either. Being a geek I was anything but content with this situation. I finally found a solution to control the brightness using keyboard shortcuts.
As much as I love Joomla!, there is a shortcoming compared to the other two major Open Source PHP CMS, WordPress and Drupal: it doesn’t come with a command-line interface like wp-cli or drush. This is a bit of a problem when you’re in need of mass-provisioning sites with extensions or updates in an unattended manner. Using a CLI tool is the only way to provide a scriptable, efficient and unattended method of doing so. In this post we’ll see a practical way to overcome this limitation.
My last week’s blog post on running Apache, MySQL, PHP server on Windows with multiple, simultaneous PHP versions seems to have been a smash hit. This week we’ll be doing the same thing on Mac OS X. For those of you who didn’t click the link, I decided it would be a cool, geeky project to implement an Apache-MySQL-PHP web server without using a pre-packaged server like MAMP or Zend Server. My goal was to have the same sites run under different versions of PHP by just visiting a different URL on my browser. This makes cross-PHP testing of sites a piece of cake.
I just bought an Intel NUC (Next Unit of Computing) mini-PC to serve as my secondary, Windows-powered development machine (the primary is an Apple Mac Mini). I decided it would be a fun* weekend project to implement an Apache-MySQL-PHP web server without using a pre-packaged server like XAMPP, WAMPServer etc. My goal was to have the same sites run under different versions of PHP by just visiting a different URL on my browser.
* for extremely geek values of “fun”