Web Designer/Developer - Drupal experience a must!
Aquent
US-CA-San Francisco

Justtechjobs.com Post A Job | Post A Resume

Two PHP's are Better Than One
How to Setup Multiple PHP Builds on The Same Server
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 ]


Comments:
RE: Another way to do thisBruce01/16/04 11:31
Another way to do thisMoSs05/25/03 08:23
RE: Overhead of CGI squanders benefits of C?Ian12/30/02 14:31
RE:Stupid Article and other thingsWill Green09/03/02 15:18
need some helpfantaghiro09/02/02 04:17
RE: A simpler wayAmit Kothari08/31/02 07:51
RE:Stupid Article and other thingsMichael Galloway08/27/02 11:59
RE: To anwser some questionsTony08/26/02 06:57
I stand correctedMichael Galloway08/24/02 14:24
Stupid articleJames08/24/02 11:47
Re: A simpler wayMark Constable08/23/02 23:33
To answer some questionsMichael Galloway08/20/02 12:18
Overhead of CGI squanders benefits of C?Jeff08/16/02 03:23
very useful!chickoslav08/15/02 01:42
A simpler wayTony08/13/02 05:22
CGI vs PHP moduleJoe Li08/12/02 03:55
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.