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

Inviqa techPortal:
Speedy Sites: Nginx and PHP
Feb 21, 2014 @ 17:55:17

On the Inviqa techPortal site today they have a new post from Barney Hanlon in his "Speedy Sites" series. This time he looks at using nginx to speed up your PHP applications.

In the previous article in this series, we looked at using Apache with mod_pagespeed to perform on-the-fly enhancements to decrease page load times. Getting an optimised page is only half the battle however; we need to ensure that our backend is doing as little work as possible in order to be highly scalable. In this article, we look at how we can achieve this while improving performance – all with nginx.

He starts with an introduction to nginx for those not familiar with this alternative web server and how it integrates with PHP. He walks you through the installations and configuration of a basic setup and running some benchmarks with siege. Finally, he shows how to enable PHP support on the install via the "php5-fpm" package (FastCGI).

tagged: speed webserver nginx fastcgi fpm install configure tutorial

Link: http://techportal.inviqa.com/2014/02/20/speedy-sites-nginx-and-php/

SitePoint PHP Blog:
HHVM revisited
Dec 23, 2013 @ 16:57:01

The SitePoint PHP blog has a new post from Bruno Skvorc talking about a technology that's growing more and more popular all the time in the PHP ecosystem - HHVM, the virtual machine version of Facebook's HipHop software.

Just over two years have passed since the last post about HHVM by Matt Turland. What changed in that time? Did anything? Let's see just how successful PHP's quest for performance was.

Bruno takes a step back and, for those not sure what the HHVM is, explains the technology a bit and what some of the project's goals are. He talks about its compatibility with current software (like OSes and web servers) and the inclusion of FastCGI support. He also talks about some of the other main issues around the use of the HHVM like:

  • Performance considerations
  • Pre-analyzing
  • Authoritative Cache
tagged: hhvm update article performance fastcgi cache

Link: http://www.sitepoint.com/hhvm-revisited/

HHVM Blog:
FasterCGI with HHVM
Dec 18, 2013 @ 15:19:35

On the HHVM blog today they've posted an announcement about a new feature of this already powerful environment to help broaden the user base - FastCGI support.

Today, we are happy to announce FastCGI support for HHVM. FastCGI is a popular protocol for communication between an application server (e.g. running your PHP code) and a webserver. With support for FastCGI, you will be able to run HHVM behind any popular web server (Apache, Nginx, Lighttpd, etc). The webserver is in charge of handling all the intricate details of the HTTP protocol. HHVM is in charge of what it does best, running PHP code blazingly fast.

The post goes on to talk about how it all works including how it enables an instance of HHVM to run between requests (and serving multiple requests in parallel). It uses asynchronous I/O and a separate set of worker threads to execute the code. The rest of the post shares the results of a few benchmarks and gives you a step-by-step guide to getting it up and running.

tagged: hhvm fastercgi fastcgi install benchmark introduction hiphop

Link: http://www.hhvm.com/blog/1817/fastercgi-with-hhvm

Kevin Schroeder:
Why is FastCGI /w Nginx so much faster than Apache /w mod_php?
Jan 08, 2013 @ 18:43:23

In this new post to his site Kevin Schroeder takes a look at the performance difference between Apache+mod_php and Nginx+FastCGI and why the second is noticeably faster than the second.

I was originally going to write a blog post about why NginX with FastCGI was faster than Apache with mod_php. I had heard a while ago that NginX running PHP via FastCGI was faster than Apache with mod_php and have heard people swear up and down that it was true. I did a quick test on it a while back and found some corresponding evidence. Today I wanted to examine it more in depth and see if I could get some good numbers on why this was the case. The problem was that I couldn’t.

He uses a "hello world" script as a baseline to do some testing and the ab to run the numbers. His results show a pretty significant difference between the two setups and an "strace" on Apache showed a clear "winner" as to why it's slower (reading the .htaccess file). Once he turned this off, though, Apache jumped up and started performing better than Nginx.

This all makes sense. mod_php has PHP embedded in Apache and so it should be faster. If you're running only PHP on a web server then Apache still seems to be your best bet for performance. And if you are seeing a significant performance difference then you should check if AllowOverride is turned on. If it is, try moving that into httpd.conf and try again.
tagged: nginx apache fastcgi phpfpm modphp performance htaccess

Link:

Pavel Shevaev's Blog:
Make php-fpm execute arbitrary PHP scripts via socket
Oct 26, 2011 @ 16:19:23

Pavel Shevaev has a quick new post to his blog showing how to get PHP-FPM to execute PHP scripts via a socket request.

We are using APC cache very heavily in our projects and during project deployment the cache must be flushed and warmed up. A common solution to warmup the APC cache is to fetch some special page via HTTP which does the job. The problem with this approach is that it’s not reliable enough when PHP is served via several fastcgi back-ends.

To solve the problem, he uses a PHP-FPM module to work with the FastCGI socket and execute any file (as permissions allow, of course). In his case, he uses it to "warm up" his APC cache for the user. A code snippet is provided as an example.

tagged: phpfpm execute socket fastcgi module tutorial

Link:

ServerGrove Blog:
How to setup multiple PHP versions on Apache
Aug 23, 2011 @ 16:07:38

On the ServerGrove blog today there's a new post from Ishmael about setting up multiple versions of PHP on one Apache instance with the help of FastCGI.

There are several reasons you might need to run multiple versions of PHP on the same server. Maybe you have a PHP 5.2 application running on your server and you need to start working on another application based on a new framework like Symfony2 or Lithium? Perhaps you haver a client with a legacy site that runs PHP 5.2, or maybe you simply want to test some of the new functionality? This post is going to explain how to setup a server to run multiple versions of PHP.

Normally, Apache can only be compiled with one version of PHP, but FastCGI gets around that by letting you define it in a configuration file instead. They also include support for defining the user the process runs as (suexec) that helps to make permissions issues lesser. Included are all of the command-line calls and config settings you'll need to make to get things set up.

tagged: multiple version tutorial apache fastcgi suexec

Link:

Brian Swan's Blog:
Reflecting on PHP-Microsoft Interoperability
Oct 08, 2010 @ 14:52:35

Brian Swan has posted a new timeline to his MSDN blog today about the road that Microsoft has traveled with PHP to get to where they are today.

This morning I came across this article on PHPDeveloper.org: Blast from the Past – One Year Ago in PHP. That brief look into the past got me to thinking about what Microsoft has done lately toward PHP interoperability. (By "lately", I mean in the last few years.) And, I’ve been working on a presentation for TechEd in Berlin next month that will, in part, provide a brief overview of Microsoft’s efforts toward PHP interoperability and support. So, I thought I’d share a bit of that summary here

The timeline runs from back in 2006 when PHP and Windows/IIS/SQL Server just wasn't much of an option through the FastCGI and SQL Server driver years and finally rounding out with WinCache, PHP 5.3 improvements for Windows and the Azure SDK for PHP.

tagged: microsoft timeline interoperability sqlserver iis fastcgi azure wincache

Link:

Matthew Weier O'Phinney's Blog:
Running mod_php and FastCGI side-by-side
Aug 10, 2010 @ 19:06:44

On his blog today Matthew Weier O'Phinney talks about how to run mod_php and FastCGI side-by-side on a Zend Server instance.

I installed Zend Server some time ago, so I'm still on a PHP 5.2 mod_php binary. I have several PHP 5.3 binaries compiled and installed locally for running unit tests and sample scripts already -- so the question was how to keep my 5.2 mod_php running while simultaneously allowing the ability to run selected vhosts in 5.3? The answer can be summed up in one acronym: FastCGI.

He shows how to enable FastCGI in Apache (on Ubuntu), make a virtual host for your site and create a "cgi-bin" directory to contain the script(s) for your PHP versions as CGIs.

tagged: modphp fastcgi parallel version

Link:

Content with Style:
Zend Framework with nginx and php-fastcgi
Aug 05, 2010 @ 16:06:02

On the Content with Style blog today there's a new post showing you how to get the Zend Framework up and running with the nginx web server running PHP as a FastCGI.

Since I while I heard good things about nginx and wanted to use it for my Zend Framework MVC applications. I just got a Ubuntu server working after one of those days that seem to be a never ending Google search and debugging session, so I thought I'd share the outcome with you.

They show you how to install the needed packages, set up FastCGI and configure it to work with nginx and, of course, configure nginx to use the FastCGI. Included in the nginx config is a pointer to the Zend Framework's document root. Setting up the Zend Framework and creating an application isn't a part of the tutorial.

tagged: zendframework nginx fastcgi webserver tutorial install configure

Link:

Ole Markus' Blog:
Gentoo Linux and PHP-FPM
Jun 29, 2010 @ 18:53:39

Because of a recent addition to the the Gentoo PHP package (FPM support) they're looking for people to test it out and report back the results. To help, Ole Markus has written up some instructions on how to get it up and working on your system with nginx.

PHP just added the FPM patch to their 5.3 branch, making it likely that PHP 5.3.3 will support the FPM SAPI. The FPM SAPI is an improved fcgi SAPI that allows for more advanced configuration than the original fcgi SAPI. One of the most useful features is process management, which makes it very useful for lightweight webservers, such as nginx, that does not handle process management of fcgi themselves.

There's only a few commands you'll need to get this new package installed and working with your local nginx install with the help of the emerge and layman tools. He also includes the configuration change you'll need to make to the nginx config file to get it working as a FastCGI module.

tagged: gentooo linux phpfpm tutorial test fastcgi nginx

Link:


Trending Topics: