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

Systems Architect Blog:
Apache2 vs Nginx for PHP application
Mar 29, 2013 @ 15:41:38

On the Systems Architect blog there's a recent post from Lukasz Kujawa about comparing Apache2 and Nginx for PHP applications, specifically when using the PHP-FPM module. His tests are based on the results from three different application types - a large Zend Framework 1 app, a small PHP script and a WordPress installation.

If you’ve ever been trying to squeeze more out of hardware you must have come across Nginx (engine x). Nginx usually appears in context of PHP-FPM (FastCGI Process Manager) and APC (Alternative PHP Cache). This setup is often pitched to be the ultimate combo for a web server but what that really means? How much faster a PHP application is going to be on a different web server? I had to check it and the answer as often is – that depends.

He ran the tests on an Amazone EC2 instance and optimized the server to ensure that there was a little interference as possible. The used the Zend Optimizer Plus opcode cache and PHP 5.4 and set the logs to go to memory instead of disk. Graphs included in the post show the results of the benchmarking of each application, with the differences (in most cases) not being that wide of a gap.

There isn’t big difference between Apache2 and Nginx in PHP context. Yes, Nginx can be much faster when delivering static content but it won’t speed up PHP execution. Running a PHP script seams to be so CPU challenging task that it completely eclipse any gain from a web server.
tagged: apache2 nginx performance benchmark zendframework1 wordpress native

Link:

Konstantin Kudryashov:
Autohosts for Symfony projects on Mac
Oct 18, 2012 @ 15:39:43

Konstantin Kudryashov has posted a helpful hint for any web developer out there that knows the pain of constantly setting up VirtualHosts and local hostnames during their development. His suggestion makes setting them up simple using Apache2's "autohosts" support.

We all know, that web development is not as easy as it sounds and that it involves lot of different and sometimes really complex tools to just run or test stuff. We also know, that bootstrap (setup) of the project could take more time than you want it to. It’s not a big deal if you’re working on single project full time, but at KnpLabs, i’m bootstraping new sf2 project every 2 weeks. So this manual crafting of virtual host, edition of /etc/hosts and maintaining of those temp hosts everywhere made me really sick. So, at some point i’ve started to look for an elegant solution. Here is it.

He gives you all the commands, file contents and software you'll need to install (he uses Homebrew) to install dnsmasq and get it configured. The only Symfony-specific part of the process is the last step - getting the latest version of the framework and installing it.

tagged: autohost apache2 configuration virtualhost localhost automate

Link:

Bence Eros' Blog:
Creating an interactive debugger for PHP
Jan 26, 2011 @ 14:53:48

Bence Eros has submitted a new post from his blog that looks at the method he came up with to create an interactive debugger for PHP. It's just a prototype/proof of concept that lets you execute PHP code in the browser (using eval - a little scary, I'll admit).

Last night I created a prototype for an interactive debugger for PHP without the need of any IDE-plugin. In this post I'm going to show what I found. Unfortunately you will need some time to put the environment together, but I think it's worth doing it. My target was to create a way how you can view and modify your variables manually at runtime, only by inserting one line code.

He does mention that, because of the settings he uses, the debugger can only be loaded from a different domain than the application which can be restricted a bit simpler (i.e. its own https or .htauth). His setup uses an Apache2 web server and a few PHP/HTML scripts to get the job done. In the end you'll have something similar to this for you to run your code in.

tagged: interactive debugger webbased tutorial apache2

Link:

Ilia Alshanetsky's Blog:
Beware of the default Apache 2 config for PHP
Aug 31, 2010 @ 14:38:57

Ilia Alshanetsky has a suggestion for those setting up PHP and Apache2 for the first time - beware of the default configuration!

About a week ago, I was doing some upgrades on my development machine and came across a rather nasty issue when it comes to how .php(s) files are associated with PHP in Apache. It seems that a number of distros including Gentoo (which is what I was using) are using the [same] configuration directive to make the PHP module parse PHP files

The problem comes from their use of "AddHandler" versus "AddType" when telling Apache which files to parse as PHP. The first allows anything with ".php" in its filename to be parsed while the second limits it to just files ending in ".php". Check your configuration to ensure you're not open to this issue, especially if there's scripts/files outside of your control.

tagged: apache2 configuration problem parse addhandler addtype

Link:

HowTo Forge:
How To Harden PHP5 With Suhosin (Debian Etch/Ubuntu)
Apr 04, 2007 @ 16:36:00

On the HowTo Forge website, there's a new tutorial all set to walk you through hardening your PHP5 setup on Debian Etch/Ubuntu with the help of the Suhosin patch.

This tutorial shows how to harden PHP5 with Suhosin on Debian Etch and Ubuntu servers. [...] This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

They start with the initial install of Apache2 and PHP5 (via apt-get) to get the stage set. Building on that is simple - making another apt-get call to pull in the PHP binaries, a wget to grab the latest Suhosin patch, and you're just a few dpkg-buildpackage commands away from having a working setup. Check out the project's configuration page to get more details on tweaking the setup.

tagged: haren php5 installation suhosin patch aptget apache2 haren php5 installation suhosin patch aptget apache2

Link:

HowTo Forge:
How To Harden PHP5 With Suhosin (Debian Etch/Ubuntu)
Apr 04, 2007 @ 16:36:00

On the HowTo Forge website, there's a new tutorial all set to walk you through hardening your PHP5 setup on Debian Etch/Ubuntu with the help of the Suhosin patch.

This tutorial shows how to harden PHP5 with Suhosin on Debian Etch and Ubuntu servers. [...] This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

They start with the initial install of Apache2 and PHP5 (via apt-get) to get the stage set. Building on that is simple - making another apt-get call to pull in the PHP binaries, a wget to grab the latest Suhosin patch, and you're just a few dpkg-buildpackage commands away from having a working setup. Check out the project's configuration page to get more details on tweaking the setup.

tagged: haren php5 installation suhosin patch aptget apache2 haren php5 installation suhosin patch aptget apache2

Link:

Jeremiah's Blog:
Setting Up Your Own Proxy
Mar 06, 2006 @ 14:03:48

From this quick post (on Jeremiah's blog) we learn how to create a simple proxy for your web surfing needs with the help of Ubuntu Linux, Apache2, and PHP4.

Using Ubuntu Linux, Apache2, & PHP4 we can set up our own PHP Proxy page to use at work or school for those web sites you probably shouldn't have access to.

The linux installation isnt covered, but the painless installs of the rest of the apps is summed up in a few simple lines. Following that, he shows you what needs to be edited in the Apache config and where to get the PHP proxy application from.

tagged: proxy linux apache2 php4 edit config file proxy linux apache2 php4 edit config file

Link:

Jeremiah's Blog:
Setting Up Your Own Proxy
Mar 06, 2006 @ 14:03:48

From this quick post (on Jeremiah's blog) we learn how to create a simple proxy for your web surfing needs with the help of Ubuntu Linux, Apache2, and PHP4.

Using Ubuntu Linux, Apache2, & PHP4 we can set up our own PHP Proxy page to use at work or school for those web sites you probably shouldn't have access to.

The linux installation isnt covered, but the painless installs of the rest of the apps is summed up in a few simple lines. Following that, he shows you what needs to be edited in the Apache config and where to get the PHP proxy application from.

tagged: proxy linux apache2 php4 edit config file proxy linux apache2 php4 edit config file

Link:


Trending Topics: