PHPBuilder - Two PHP's are better than one

RSS Twitter

Two PHP's are better than one

by: Michael Galloway
August 19, 2002

So I'm sitting there, one warm afternoon, thinking up ways to improve upon the software I've been developing over the last year or so. Of course, speed improvements are always sought after, as well as improved simplicity of design. When those go hand in hand, you are golden.
With PHP it is possible to accomplish both in many ways. One method I have used to great success is to createC modules to expand the core functionality of PHP. Convert a couple of those frustratingly slow, but critical, routines into C and you will very likely see a major performance boost, not to mention a pat on the back from your boss, accolades from PHP development groups, and serious respect from your fellow developers. This of course is assuming you don't bomb the compilation of PHP and shut down 30 of your e-commerce sites while you scramble to undo the mess on the server. That usually gets you a completely different reaction from you boss.
The solution my friends, is to not work on the same PHP build that is currently interpreting the myriad of websites requiring immediate services. "I know that!", you say, "But how can you run multiple builds of PHP on the same server and have some sites be served by one of the PHP builds, while the other (the test one) is served by another PHP build all while using one instance of Apache?" Well my long-winded, run-on-sentence-speaking friendĀŠ here is how you do it.
First, the context: I'm currently working with a FreeBSD system, utilizing Apache 1.3 for web services, and PHP 4.2.2. I haven't tested this out on Linux or Windows, but I do believe that any Unix flavor should be fine. The main key is Apache, or rather the configuration file: httpd.conf

Step One: Organization

For simplicity's sake, I'm going to recommend that you organize you system in such a way that each domain you are hosting has it's own PHP directory located below the document root (like cgi-bin). This directory is going to contain a link to the correct build of PHP for the site.
So here is the directory structure I am going to use:
/www/clients/myEcommerceSite This is the root of the Ecommerce site
/htdocsThe document root directory
/phpThe php compiler (and source) directory
/imagesThe images directory (obviously)
Create the same structure in your test site directory. I would also suggest thatyou create a directory somewhere else on the server to contain the actual PHPbuild. You could place the builds in the php folder for each site, but it is muchmore efficient (should you want multiple sites to use the same php build) to havea single location, and then simply link to the correct build inside the php directory.

Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Michael Galloway



(Maximum characters: 1200). You have characters left.