In this post I am trying to share with you some of my insights into what are the available server options we have when it comes to setting up our PHP development environment.
The most straightforward one is, PHP's built-in web server (php -S localhost:port). While this is a very handy option for quickly running a website, it may not be suitable in some cases as it is prone to hang up when the app is trying to perform a resource intensive tasks. If you don't know that fact, you may left wondering what on earth going wrong there.
Traditional Nginx/php-fpm stack or Apache/php-fpm combination. Also available as WAMP/XAMPP.
Vagrant
And there's
- Docker
Vagrant and Docker are both resource intensive so it can become a concern if you have many sites running simultaneously on your low/average hardware (CPU/Ram).
I've used all of the above options during my career and personally for me, it comes down to choosing between Nginx/php-fpm vs Apache/php-fpm. And I prefer to go with Nginx/php-fpm combination as Nginx scores high in many areas (including performance) over Apache. Another thing I like about Nginx is its lack of per-directory configuration. While there maybe disadvantages to it when compared to Apache, I've never been a fan of Apache's .htaccess rules. That reason alone is good enough for me to appreciate and stick with Nginx and it has been a very comfortable experience so far.
Top comments (0)