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 Mac OS X Sierra
Sep 30, 2016 @ 09: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/

Johannes Schlüter:
JSON Aggregation functions
Sep 16, 2016 @ 11:53:25

Johannes Schlüter has written up an article covering an interesting feature of the latest MySQL server release related to its JSON column handling: JSON Aggregation functions.

[The JSON datatype, functions and generated columns] combined allow building very powerful applications without committing to a fixed data structure on every part, but I was missing one thing a lot: Aggregation.

A topic I'm thinking a lot about is finding ways to select nested data. In MySQL we typically have two ways for this. Either one sends multiple queries to retrieve different nesting levels or one builds JOINs which tend to deliver repetitive responses.

He points out that one solution is the GROUP_CONCAT function, but the results of this can be difficult to work with and larger data may override the small memory space allowed. Instead he introduces two new functions in v8 to help with this nested data selection: JSON_ARRAYAGG and JSON_OBJECTAGG. He provides a brief example of the use of these two functions together to replace the "concat" handling from before.

tagged: mysql json function v8 release aggregation tutorial

Link: http://schlueters.de/blog/archives/183-MySQL-8.0-JSON-Aggregation-functions.html

Johannes Schlüter:
Types in PHP and MySQL
Sep 05, 2016 @ 13:38:21

Johannes Schlüter has a post to his site detailing the handling of types in PHP and MySQL and how they might act differently than expected in some situations.

Since PHP 7.0 has been released there's more attention on scalar types. Keeping types for data from within your application is relatively simple. But when talking to external systems, like a database things aren't always as one eventually might initially expect.

He talks about MySQL types and how they relate to the "network protocol" being used, converting everything to strings. He includes a few examples of hinting on the results, one where an integer is expected/string provided and another where a string was type hinted but an integer was returned. He points out that sometimes this is a limitation of what PHP can handle, not always what MySQL returns. He also includes other examples of returning decimals - sometimes as a number value and others as a string.

This leaves the question whether you should disable the emulation in order to get the correct types. Doing this has some impact on performance characteristics: With native prepared statements there will be a client-server round-trip during the prepare and another round-trip for the execute.
tagged: types typehinting mysql database string integer decimal preparedstatement pdo

Link: http://schlueters.de/blog/archives/182-Types-in-PHP-and-MySQL.html

Master Zend Framework:
How To Build a Local Development Environment Using Docker
Sep 02, 2016 @ 11: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/

Matt Stauffer:
New JSON-column where() and update() syntax in Laravel 5.3
Jul 11, 2016 @ 11:03:49

In his continuing series of posts looking at the new features in Laravel 5.3, Matt Stauufer has posted this guide to the use in the new JSON column functionality MySQL now provides in recent versions.

While Laravel has had the ability to cast your data to and from JSON since version 5.0, it was previously just a convenience—your data was still just stored in a TEXT field. But MySQL 5.7 introduced an actual JSON column type.

Laravel 5.3 introduces a simple syntax for lookups and updates based on the value of specific keys in your JSON columns.

He gives an example of a simple table with a JSON column storing some metadata for the entry. He includes a bit of example content showing the full entry and related metadata and the where format for querying it. It also includes the ability to run updates on the data just like with any other where clause.

tagged: laravel jon column mysql tutorial series part5 feature

Link: https://mattstauffer.co/blog/new-json-column-where-and-update-syntax-in-laravel-5-3

Prototype Quickly in Laravel with PHP’s Built-In Server and SQLite
May 06, 2016 @ 12:20:56

The Scotch.io site has a tutorial they've posted showing how to prototype a site quickly using Laravel and its built-in server/SQLite support.

If you are a seasoned Laravel developer, you know the usual project setup drill that involves creating a new project, a fresh database, and adding a virtual host entry to Apache.

If you are starting from scratch, the Apache and MySQL installation can take some time and slow things down for you. However, I will show you how you can jump start your Laravel development without Apache and MySQL.

The tutorial shows you how to use the internal PHP server to host the application, run a Laravel site inside it and integrate SQLite as the database. Each section comes with some example code and the commands/configuration you'll need to make the system work. They also take a "deep dive" into Larvel's serve command and how it bootstraps the Laravel instance for the PHP built-in server. The post ends with a look at switching back to MySQL and a comparison of SQLite vs MySQL (as well as using SQLite for production).

tagged: prototype laravel builtin server sqlite mysql tutorial

Link: https://scotch.io/tutorials/prototype-quickly-in-laravel-with-phps-built-in-server-and-sqlite

Laravel News Podcast:
Episode #13 - Chrome Extension for Tests, Jigsaw, Fixing MySQL Memory & More
Apr 08, 2016 @ 10:52:03

The Laravel News Podcast has released their latest episode, Episode #13 hosted by PHP and Laravel community member Eric L. Barnes.

In this episode, we talk about Laravel Exception Reporter, Chrome Bandwidth limiter, Chrome extension to generate Laravel tests, Jigsaw, Helpspot Vault, Fixing MySql Memory, Sparkwatch, and Taxes.

You can listen to this latest episode either using the in-page audio player or by subscribing either through iTunes or their RSS feed.

tagged: laravelnews podcast ep13 chrome tests jigsaw vault mysql memory ericbarnes

Link: https://laravel-news.com/2016/04/laravel-news-podcast-13/

CloudWays Blog:
“The Main Thing I Stress Is That You Determine Your Real Needs” Reveals MySQL Expert
Apr 05, 2016 @ 10:16:58

The Cloudways blog has posted an interview today with Dave Stokes, the MySQL Community Manager at Oracle and frequent speaker at PHP conferences and user groups.

Dave Stokes is MySQL Community Manager at Oracle and a certified MySQL 5.6 database administrator. He has vast experience of DB administration and has been MySQL Certification Manager at SUN. In his interview with Cloudways, he talks about the start of his career, compares MySQL with MariaDB and other MySQL forks in some detail, also talks about NoSQL in detail and, in the end, he gives wonderful advice to students. Enjoy the wide-ranging interview.

Dave answers questions about:

  • How he got started as the MySQL Community Manager
  • His suggestions for choosing one fork of MySQL for you needs
  • How MySQL competes with other database types (like MongoDB)
  • Where people can follow the MySQL community
  • His advice to beginners and students looking to build a career in database development

You can read Dave's answers to these and more questions in the full interview.

tagged: cloudways interview davestokes mysql community oracle

Link: http://www.cloudways.com/blog/interview-dave-stokes/

eZ Blog:
How to optimize performance of the LAMP stack with eZ (Part 1)
Mar 03, 2016 @ 11: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

Matt Stauffer:
"Strict" mode and other MySQL customizations in Laravel 5.2
Feb 29, 2016 @ 10:47:24

In a new post to his site Matt Stauffer revisits the topic of "strict" mode with MySQL and Laravel with some customizations you can make around how your application uses it.

If you remember my post How To Disable MySQL Strict Mode on Laravel Forge (Ubuntu), you'll remember that MySQL 5.7 introduced something we've been casually calling "strict mode," which is really a combination of new modes that, in sum, make MySQL process your queries a little more strictly than before.

In my previous post I showed how to disable it on Ubuntu, but since then, Adam Wathan has added a feature to Laravel that allows you to define whether you're using "strict" mode and also allows you to customize exactly which modes you'd like enabled--all in code.

He briefly goes back over what the "strict" in "strict mode" means for your database and application, including a list of the set of modes it contains (essentially a grouping of modes). He then shows how to use the new feature to enable/disable it in a Laravel (5.2+) application through the database configuration. You can also get more in-depth and enable/disable individual modes that the "strict" mode contains if you need a bit more custom handling.

tagged: strict mode mysql customize laravel mysql example configuration

Link: https://mattstauffer.co/blog/strict-mode-and-other-mysql-customizations-in-laravel-5-2