| About PHPA |
| Q. |
What license is there with PHPA? |
| A. |
There is no official license for PHPA, and it's free for use. Because it's still under active development, if distributed then it should be made clear where it originated, and users made aware that there may be a newer version than the version they have. |
|
| Q. |
What product support is there for PHPA? |
| A. |
Despite PHPA being free and a one-person development project, there is total commitment in striving to provide world class support through emails and the Forum. Currently this means that emails will generally be responded to in full within 24 hours, although quite often within just a few hours or even minutes! Problems are taken very seriously, and all efforts made to resolve any issues that users have in getting set up and running successfully. It is felt very strongly that even though the PHPA project is a proven success in offering by far the best performance of any non-commercial code cache, and for that matter about the best performance of any cache, the project would be nothing but a failure if the commitment to and level of support was anything less than excellent. |
|
| Q. |
Can I download the source? |
| A. |
The source is not currently available for download but may be released in the future. I like to release 'ready-to-go' versions as it's
simpler for users and there's no need to fiddle with compilers etc. |
|
| Q. |
Are my scripts still dynamic if I use PHPA? |
| A. |
Absolutely! A code cache such as PHPA should not be confused with a cache that caches page output (although these can be beneficial too). Scripts accelerated by PHPA remain exactly as dynamic as they were without acceleration. The about page describes how PHPA achieves its script acceleration. |
|
| Q. |
Does PHPA recache my scripts if they change, and if so, when? |
| A. |
Yes. PHPA always recaches scripts if their modified time is different (more recent or older) to the modified time when they were last cached. |
|
| Q. |
Does PHPA work with Zend Optimiser? |
| A. |
No. The Zend Optimiser prevents any 3rd party extensions from
being loaded. However PHPA does include its own code optimiser to
enhance performance slightly and reduce code size. New optimisations are
being written, and a more advanced optimiser may be incorporated into later
releases. |
|
| Platform Support |
| Q. |
On what platforms is PHPA available? |
| A. |
The main platforms are Linux, OpenBSD, FreeBSD, BSDi, and Solaris. Windows is likely in the future, and MacOS X may be supported. |
|
| Q. |
Is PHPA available for PHP before version 4.0.6? |
| A. |
PHPA is compatible with PHP 4.0.5 and known to be being used with that version, but it hasn't been built or tested with versions prior to 4.0.6. I had to choose a baseline PHP version, and 4.0.6 had for some time been the current PHP version. If you can, upgrade to 4.1 as this is faster than previous versions and more stable than 4.0.6. |
|
| Q. |
I'm using Apache2. Is PHPA compatible? |
| A. |
It is for non-thread safe Apache2, and that's the default for PHP 4.3.0 builds. |
|
| Q. |
I'm not using Apache. Will PHPA run on my web server? |
| A. |
Possibly not at the moment. Let me know what web server you're using and I'll consider looking to supporting it in the future. Zeus appears to be the most common alternative to Apache, and that will be the next server to target. |
|
| Configuration |
| Q. |
What are the shm_ttl and shm_stats_check_period settings? |
| A. |
Each script has a time-to-expiry value, and a script
expires when its
time to expiry reaches 0. The shm_ttl value is the value used to set the
time-to-expiry value when a script is accessed. Put another way, the shm_ttl
value is the period after which an unaccessed script expires.
The shm_stats_check_period is the minimum interval between checks of the
cache for expired scripts. The first server request after the interval has
elapsed will trigger a scan of the cache for expired scripts, and remove
any entries that it finds. |
|
| Q. |
How do I set the shm_user and shm_group ini entries? |
| A. |
They should be set to the same user and group settings as used in the apache httpd.conf file. From release 1.3.2 these should generally not need to be set manually, and PHPA will detect the settings used by Apache. There's also some more detailed information about this. |
|
| In Use |
| Q. |
How can I tell if PHPA is accelerating my pages? |
| A. |
PHPA adds an X-Accelerated-By: HTTP header if it processed a page, and the HTTP viewer from RexSwain is a great tool for checking your domain. With the viewer, enter a URL for your site, select a HEAD (Header only) request, and submit. If the response includes the X-Accelerated-By: header, e.g. for for this site, then PHPA processed that page.
From release 1.2p4 there is also a global variable
$_PHPA, and
$_PHPA['ENABLED'] is set to
true if PHPA is activated for the current request.
You can see the variable output below. PHPA is disabled for this request, and
notice that the
ENABLED element changes if you select the accelerated page. The display uses var_dump().
NULL
|
|
| Q. |
phpinfo() shows no PHPA and there's no error message in the server log. What's wrong? |
| A. |
First, check the web server error log for messages, and then check that you've edited the correct php.ini file and that the path you gave for the PHPA library is valid. If everything looks ok, but there's no error message in the error log, look at again at the output phpinfo() for the setting at the top that says 'Debug Build'. It must be set to 'no' for PHP to load the extension. If set to 'yes' then rebuild your PHP installation without debug support and you should be fine. Send a support email if you're still stuck |
|
| Q. |
I see "Failed loading [...] undefined symbol: _ecalloc". What does that mean? |
| A. |
This usually means that you're trying to use PHPA that was built for a version of PHP that's older than the one you're using, e.g. you downloaded PHPA for PHP 4.1.x but are using PHP 4.2.x. Check your PHP version carefully by looking at the output from calling phpinfo() and download PHPA again. |
|
| Q. |
It's not working! What can I do? |
| A. |
Email support@php-accelerator.co.uk with your problems. Email is checked often, and you should normally receive a response within 24 hours, but often much sooner. |
|
| Q. |
I see "failed to get lock" or "permission denied" in the error log. Why? |
| A. |
This is a permissions issue, and is usually because either shm_user or shm_group were set incorrectly (although PHPA sets these itself from PHPA 1.3.2r2 onwards). |
|
| Q. |
Apache hangs when I restart. What can I do? |
| A. |
This is most likely because you have the dbg module enabled in php.ini. Dbg is incompatible with
PHPA, so disable dbg, restart, and you should be fine. For performing a clean
restart or checking other things, there is more detailed information about this. |
|
| Q. |
My scripts no longer work. What can I do? |
| A. |
Firstly please see the previous comment concerning dbg. Although unlikely with the latest versions, if your scripts appear to behave differently with PHPA installed then please get in touch with an email to support@php-accelerator.co.uk and help to make PHPA better. The benefit of PHPA is potentially huge for users seriously concerned about performance, and your feedback may be invaluable in helping to swiftly address any shortcomings. |
|
| Q. |
How can I measure the acceleration from PHPA? |
| A. |
You could use getmicrotime() (see below) to get the start
and end times and display the difference. This will only be approximate because
the file(s) that define and call getmicrotime() must already have been parsed
before being called. However includes happen during script execution,
so the acceleration of any files included after calling
getmicrotime() can be measured. The actual acceleration will be slightly
better than calculated.
A further enhancement is to call ob_start() before any output is generated, and
ob_end_flush() after noting the end
time. Output will then be buffered, only being sent to the client after the
end of processing time has been noted, and this should eliminate any effect
of slow network connections on the timing.
To capture the start time:
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$script_start = getmicrotime();
To display the processing time in seconds:
echo sprintf("%.4f",(getmicrotime() - $script_start));
|
|
| Q. |
Why do scripts get faster only after the first hit? |
| A. |
When PHPA caches a new or changed script, it first runs
its built in code optimiser on the compiled code, caches the
script in a cache file, and caches the script in shared memory. All this
adds to the usual processing time. Until the script changes again, it will
accessed directly in shared memory, and the acceleration will be achieved.
Apache also shuts down PHPA after a restart, including graceful restarts, and
PHPA then releases the shared memory cache. So after a restart, the first hit
will read from a cache file, but also recache the file into shared memory
again. There is also additional processing required for the first request of
every apache process. |
|
| Q. |
What does Stale process 18768 detected in my log file mean? |
| A. |
This indicates that PHPA detected that the webserver process with process id 18768 had crashed. When PHPA detects a crashed a process, it performs the necessary housekeeping actions that the dead process would have performed had it not crashed. |
|
| Q. |
Why did my webserver crash? |
| A. |
Not all webserver configurations are stable, and software bugs in PHP, Apache modules, or PHPA itself could eventually cause server crashes. There are, for example, known to be bugs in some PHP 4.0.6 array functions that can eventually cause crashes, and also a problem suspected to be in the MySQL driver of PHP 4.1.2. A user has reported that the PHP MySQL driver problem is suspected to be if mysql_select_db() is called with no connection parameter, and where
$conn = mysql_pconnect("host","username","pass");
mysql_select_db("db1",$conn);
$query = mysql_query("SELECT * FROM xxx",$conn)
while ($row = mysql_fetch_array($query)) do_stuff();
would work, while
$conn = mysql_pconnect("host","username","pass");
mysql_select_db("db1");
$query = mysql_query("SELECT * FROM xxx")
while ($row = mysql_fetch_array($query)) do_stuff();
would randomly crash. There are undoubtedly many factors that may together ultimately result in a server crash. Periodic checking of server logs, with or without extensions installed such as PHPA, is recommended to see whether or not your server configuration is stable. If it isn't, then a remedy should be sought, or at least defensive action such as setting a low(er) value for the apache MaxRequestsPerChild parameter. |
|
| Miscellaneous |
| Q. |
Who are Fidion? |
| A. |
Fidion are a German software company who have kindly donated a dedicated server to host the PHP Accelerator site. They are not associated with the project development in any way, but as one of the users of PHPA, their generous support and feedback has been and remains invaluable. |
|
| Q. |
Who are 123-reg? |
| A. |
123-reg.co.uk are an OpenSRS based supplier of low-cost domain names, and claim to be the worlds cheapest. I bought my first domains from the likes of register.com and network solutions, and whilst their services are fine, I later realised that there were much better value alternatives. This was particularly evident when a full priced supplier wanted to charge me $90 to renew a UK domain name for two years, when the 123-reg cost was less than $10 - for two years! Needless to say, I transferred the domain away from the full price registry that I'd naively used the first time. I have found that some cheap domain name companies have hidden costs, and the first such company that I used has similarly cheap domain names but always charges extra for domain hosting, even if you don't need it, and I don't. 123-reg don't make this charge mandatory, although they offer the service, and so you just pay for the domains + UK VAT. They also offer an affiliates program. So, while I remain happy with their service (hopefully forever!), and particularly after the $90 ripoff attempt, I felt that they and my experiences might be useful to mention. |
|
| Q. |
How do the accelerated/non-accelerated pages on the PHPA site work? |
| A. |
The timings page explains how this is done. |
|