Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jason McCreary:
Installing Apache, PHP, and MySQL on macOS Mojave
Nov 30, 2018 @ 17:21:05

Jason McCreary has provided a tutorial on his site today for all of the OS X Mojave users out there about how to install Apache, PHP and MySQL on macOS with the latest operating system changes. This is an update of his previous post covering the same installation on OSX Sierra.

I am aware of the web server software available for macOS, notably MAMP, as well as package managers like brew. These get you started quickly. But they forego the learning experience and, as most developers report, can become difficult to manage.

The thing is macOS runs atop UNIX. So most UNIX software installs easily on macOS. Furthermore, Apache and PHP come preinstalled with macOS. To create a local web server, all you need to do is configure Apache and install MySQL.

He walks you through the full process to get everything up and running:

  • testing to ensure Apache can be started (it comes installed by default)
  • changing the configuration to enable PHP
  • making a phpinfo page in your DocumentRoot to test that PHP is working
  • downloading and installing MySQL
  • configuration changes required to connect PHP and MySQL

He also includes an example of additional changes such as enabling mod_rewrite and a link to a tutorial about setting up virtual hosts on your local machine.

tagged: installation osx mojave update tutorial mysql apache configuration

Link: https://jason.pureconcepts.net/2018/11/install-apache-php-mysql-mac-os-x-mojave/

SitePoint PHP Blog:
Apache vs Nginx Performance: Optimization Techniques
Jun 15, 2018 @ 17:22:11

On the SitePoint PHP blog they've posted a tutorial from author Tonino Jankov sharing some techniques you can use to increase the performance of Apache and Nginx when serving up your web applications.

The article starts with some of the basics, introducing both the software and some of the concepts around their use and evaluation:

  • an introduction to Apache and Nginx
  • hardware considerations
  • monitoring
  • testing the systems (benchmarking)

It then starts on the tuning tips, one section for each of the web servers. For Apache it covers changes for the mpm modules, disabling htaccess and browser cache control with mod_expires. On the Nginx side, they mention changing the number of workers created, tuning the keepalive timout and setting up server-side caching.

tagged: apache nginx performance optimize tip tutorial configuration

Link: https://www.sitepoint.com/apache-vs-nginx-performance-optimization-techniques/

Rob Allen:
Using Composer with Serverless & OpenWhisk
Jun 12, 2018 @ 17:36:46

Rob Allen has posted a quick tutorial to his site showing how to user Composer in a PHP project on OpenWhisk. OpenWhisk is Apache's serverless cloud platform that's easy to scale and relatively easy to use. This is the latest in a series of posts from Rob covering its use in PHP projects.

Every PHP project I write has dependencies on components from Packagist and my Serverless OpenWhisk PHP projects are no different. It turns out that adding Composer dependencies is trivial.

He uses a simple action that coverts a number to the matching string, showing the yaml configuration changes and code to include to define the action. The action makes use of the NFNumberToWord package which is then added via Composer. He deploys the action and calls it directly, showing the result to be the correct string for the number "123". He also mentions an archive file (zip) that the serverless functionality creates containing all of the files related to the project. He shows the configuration option you can use to split these by action, making it easier to create a more modular system.

tagged: composer service openwhisk tutorial serverless deploy apache

Link: https://akrabat.com/using-composer-with-serverless-openwhisk/

Jason McCreary:
Installing Apache, PHP, and MySQL on Mac OS X Sierra
Sep 30, 2016 @ 14:12:28

In a new post to his site Jason McCreary has posted an update to his previous "installing Apache, MySQL and PHP" post with a few changes for macOS Sierra. The changes don't make the installation too much different, however.

Mac OS X runs atop UNIX. So most UNIX software installs easily on Mac OS X. Furthermore, Apache and PHP come packaged with OS X. To create a local web server, all you need to do is configure Apache and install MySQL.

I am aware of the web server software available for Mac OS X, notably MAMP. These get you started quickly. But they forego the learning experience and, as most developers report, can become difficult to manage.

He walks you through the process of getting Apache up and running and the current version of PHP configured and working with it. He shows how to verify PHP is working as expected, how to install the DMG of MySQL and make it also work happily with the PHP installation. There's also a bit at the end you can enable to add in some additional Apache module support for mod_rewrite, mod_expires and mod_deflate.

tagged: install tutorial apache mysql macos sierra

Link: http://jason.pureconcepts.net/2016/09/install-apache-php-mysql-mac-os-x-sierra/

Master Zend Framework:
How To Build a Local Development Environment Using Docker
Sep 02, 2016 @ 16:57:05

The Master Zend Framework site has posted a tutorial helping you create a Docker-based development environment complete with PHP, MySQL and Apache working happily together.

Why in this modern day and age is setting up a development environment still such a complicated process? [...] Why is it still so hard to get one setup that works, that does what you need, and that matches the deployment environment’s of testing, staging, production and so on?

[...] By now our development environments have grown quite sophisticated. But the overhead of both building and maintaining them has increased significantly also. Wouldn’t it be easy if we could set them up, but with only a small investment of time and effort? I think you know where I might be heading with this. You can. Yes, that’s right, you can. Ever heard of Docker?

He then starts in on introducing Docker (for those not already familiar) and how it differs from a VirtualBox/Vagrant setup that's already become quite popular. He talks about "containers" and the role they play as well as an overview of the environment he's going to show you how to create. He then helps you get Docker installed, explains how the containers will work together and provides the Docker YAML configuration for each of them. The docker-compose command is then used to bring the environment up, downloading the containers as needed. The final result of his setup is a set of containers running together to serve up a Zend Framework Skeleton Application.

tagged: docker local development environment tutorial introduction mysql apache zendframework skeleton

Link: http://www.masterzendframework.com/docker-development-environment/

Michelangelo van Dam:
Compile PHP 7 on Mac OS X 10.11 "El Capitain"
Jul 19, 2016 @ 14:34:33

In a new post to his site Michelangelo van Dam has posted a guide to compiling PHP 7 on OSX "El Capitan", the latest release of the popular Apple operating system.

Apple has made a numerous changes to the way OS X (10.11) "El Capitain" uses open source elements like PHP and OpenSSL. Compiling PHP from source requires a bit more modifications.

This article is a follow-up on my previous post <a href='http://www.dragonbe.com/2015/12/installing-php-7-with-xdebug-apache-and.html">Installing PHP 7 with XDebug, Apache and MySQL on OS X Yosemite.

He then provides the commands and configuration information you'll need to get things up and running:

  • OpenSSL
  • PHP 7
  • Apache

The end result is a simple PHP 7 installation with plenty of features installed.

tagged: compile php7 mac osx elcapitan openssl apache

Link: http://www.dragonbe.com/2016/07/compile-php-7-on-mac-os-x-1011-el.html

SitePoint PHP Blog:
How Can the ELK Stack Be Used to Monitor PHP Apps?
May 12, 2016 @ 15:42:36

The SitePoint blog has posted a new tutorial from author Daniel Berman about using the ELK stack to monitor PHP applications. The ELK stack is made up of Elasticsearch, Logstash and Kibana to make for effective log storage and searching.

A modern web application environment consists of multiple log sources, which collectively output thousands of log lines written in unintelligible machine language. If you, for example, have a LAMP stack set up, then you have PHP, Apache, and MySQL logs to go through. Add system and environment logs into the fray — together with framework-specific logs such as Laravel logs — and you end up with an endless pile of machine data.

Talk about a needle in a haystack. [...] The ELK Stack (Elasticsearch, Logstash, and Kibana) is quickly becoming the most popular way to handle this challenge. Already the most popular open-source log analysis platform — with 500,000 downloads a month, according to Elastic — ELK is a great way to centralize logs from multiple sources, identify correlations, and perform deep-data analysis.

They walk you through the full installation of all three tools starting with Java (they all require it) followed by instructions for each piece. Once they're all up and running (and playing nice together) they help you configure it to pull in Apache access logs and search on the results. They then populate it with quite a bit more sample data and share some basic tips on searching using the custom searching "language". Finally they talk about the visualizations Kibana offers complete with an example showing browser percentages from users of the site.

tagged: elk stack tutorial monitor elasticsearch logstash kibana setup configure apache log

Link: http://www.sitepoint.com/how-can-the-elk-stack-be-used-to-monitor-php-apps/

Jeff Geerling:
Streaming PHP - disabling output buffering in PHP, Apache, Nginx, and Varnish
Apr 06, 2016 @ 18:45:27

In a recent post to his site Jeff Geerling shows you how to disable the output buffering that PHP includes and create "streaming PHP" code similar to Drupal's recently introduced BigPipe handling.

For the past few days, I've been diving deep into testing Drupal 8's experimental new BigPipe feature, which allows Drupal page requests for authenticated users to be streamed and loaded in stages—cached elements (usually the majority of a page) are loaded almost immediately, meaning the end user can interact with the main elements on the page very quickly, then other uncacheable elements are loaded in as Drupal is able to render them.

[...] BigPipe takes advantage of streaming PHP responses (using flush() to flush the output buffer at various times during a page load), but to ensure the stream is delivered all the way from PHP through to the client, you need to make sure your entire webserver and proxying stack streams the request directly, with no buffering.

He decided to try out different configurations to see if he could reproduce the same thing outside of Drupal and - good news, everyone - he found a reliable way. He starts with a basic procedural script that emulates BigPipe and calls a flush inside a loop to push the latest output to the waiting client. While this cooperates on the command line the browser doesn't cooperate the same way. A small tweak helps it work, so he shows how to reproduce this reliably across the full stack - Nginx, Apache and Varnish.

He ends with a quick warning for those using VMWare/VirtualBox about some oddness he experienced in buffering the responses and includes a way to test if it's your script or the VM causing the trouble.

tagged: stream output disable buffering apache nginx varnish tutorial

Link: http://www.jeffgeerling.com/blog/2016/streaming-php-disabling-output-buffering-php-apache-nginx-and-varnish

eZ Blog:
How to optimize performance of the LAMP stack with eZ (Part 1)
Mar 03, 2016 @ 17:43:51

On the eZ blog there's a new post, the first part of a series, showing how to optimize the performance of your LAMP stack with the help of some tuning on the server and software levels.

Nowadays, a website is not only a simple HTML page. Your visitors expect dynamic, personalized information fast and you need a scalable way to deliver content as quickly as possible. This, of course, puts significant pressure on page loads and response time. In this series of posts, we’ll explore eZ’s system architecture and provide recommendations on how you can optimize caching and decrease response time with eZ software.

They then talk about the various pieces of software that make up a typical environment and some tips on optimizing them:

  • Varnish
  • Apache
  • MySQL and MariaDB

Each includes the configuration changes and setup that's helped eZ get the most out of their stack and links to other tools to help you evaluate the performance differences.

tagged: optimize performance lamp stack series part1 varnish apache mysql mariadb

Link: http://ez.no/Blog/How-to-optimize-performance-of-the-LAMP-stack-with-eZ-Part-1

Nginx.com:
Maximizing PHP 7 Performance with NGINX, Part I: Web Serving and Caching
Feb 29, 2016 @ 19:55:10

On the Nginx.com site they've posted the first part of a series showing you how to maximize your performance with PHP 7 and this already speedy web server.

PHP is the most popular way to create a server-side Web application, with roughly 80% market share. (ASP.net is a distant second, and Java an even more distant third.) [...] Now the PHP team is releasing a new version, PHP 7 – more than a decade after the introduction of PHP 5. During this time, usage of the web and the demands on websites have both increased exponentially.

[...] This blog post is the first in a two-part series about maximizing the performance of your websites that use PHP 7. Here we focus on upgrading to PHP 7, implementing open source NGINX or NGINX Plus as your web server software, rewriting URLs (necessary for requests to be handled properly), caching static files, and caching dynamic files (also called application caching or microcaching).

They start by looking at why "PHP hits a wall" in its execution in high load situations, stepping through the process it follows to handle each request. They also share some of the common ways PHP developers have combatted these issues including more hardware, better server software and multi-server setups. They then get into the actual tips themselves:

  • Tip 1. Upgrade to PHP 7
  • Tip 2. Choose Open Source NGINX or NGINX Plus
  • Tip 3. Convert Apache Configuration to NGINX Syntax
  • Tip 4. Implement Static File Caching
  • Tip 5. Implement Microcaching

For each tip there's a summary with more information on why they make the suggestion and, for some, how to make the transition happen. In the next part of the series they'll get into reverse proxy servers and a multi-server Nginx implementation to boost performance even more.

tagged: performance php7 nginx series part1 maximize tutorial static cache apache conversion

Link: https://www.nginx.com/blog/maximizing-php-7-performance-with-nginx-part-i-web-serving-and-caching/


Trending Topics: