Tag: PHP
-
How to pipeline with phpredis
Have you ever run into a scenario where you have to loop through a set of data and perform database queries for each iteration? Obviously we shouldn’t run them one by one, so we end up using a TRANSACTION or even just building out one large query in the case…
-
How to process PUT requests with PHP
You are probably already familiar with $_GET, $_POST and $_REQUEST but what about $_PUT? Trick question, $_PUT (as well as as $_HEAD and $_DELETE) doesn’t exist in PHP at this time. Never fear! We can create a $_PUT array with the following code: if ($_SERVER[‘REQUEST_METHOD’] == ‘PUT’) { parse_str(file_get_contents(“php://input”), $_PUT);…
-
URL Routing with PHP
I’ve been taking a lot of programming tests / challenges recently as I was in the market for a new [and hopefully exciting] opportunity to spend my time on. Because of this, I am full of new blog post ideas based on the questions / challenges asked. This week I’m…
-
Google Places PHP Library
I tend to shy away from these self gratifying posts about my own open source contributions, but I’m going to make the exception because this particularly library has been receiving quote a few downloads this month. I’m unsure for the increase, but my Google Places PHP Library has had over…
-
How to Install PHP Redis on Ubuntu 14.04 LTS
Previously, I had shown you how to install PHP Redis from source but things changed with the latest Ubuntu LTS release. Now you can install the phpredis extension from the Ubuntu respositories. First, if you don’t have it installed already, let’s install Redis: sudo apt-get install redis-server After we get…
-
How to Install the MongoDB PHP Module on Ubuntu 14.04 LTS
Installing the PHP module for MongoDB on Ubuntu 14.04 LTS is just a command away, but first, let’s ensure that we have MongoDB itself installed: sudo apt-get install mongodb Once we have MongoDB installed, we can proceed with installing the module. Please note that you could combine these commands to…
-
How to Setup a LEMP Stack on Ubuntu 14.04 LTS
Last week I covered setting up a LAMP server on Ubuntu 14.04 LTS but for my money, it’s all about LEMP stacks. The “E” actually stands for Nginx (pronouced Engine X) and it’s an altnerative to the Apache web server that is built for speed and has a very low…
-
How to Setup a LAMP Stack on Ubuntu 14.04 LTS
The newest long term support release of Ubuntu (Trusty Tahr) is finally here! I just spun up a droplet over on DigitalOcean to walk through setting up a LAMP stack for this post. I also recommend making sure that your system is completely up to date. At the time of…
-
Compressing and uncompressing a string with PHP
Today I went on a mission to find a PHP function that I’ve never used before and knew nothing about. The mission was such a success that I have two functions to discuss and honestly, I’m pretty sure I’ll never use them. That being said, if the need ever arises…
-
PHP’s /e modifier is deprecated, use preg_replace_callback instead
I’ve discussed the use of preg_replace_callback in the past in regard to passing variables to anonymous functions but never touched on how to use preg_replace_callback or the fact that the /e modifier has been deprecated in PHP 5.5+. Even though /e still works in PHP 5.5 in the near future…