News
Articles
PHP Accelerators
PHP Extensions
Download
Home » PHP Accelerators

PHP Accelerators

PHP Accelerators compile PHP scripts and store them into the shared memory or on a hard drive. Compiled PHP scripts don't have to be parsed so executing them takes far less time than executing not compiled PHP scripts. If you use a PHP accelerator you can save about 50% of the server time.

Thread Safe or Non Thread Safe

For use with Appache Windows ports it is recommended to use Thread Safe (TS) versions of PHP, for use with IIS it is recommended to use Non Thread Safe (NTS) versions of PHP. Always use the PHP extensions with the same thread safety as the PHP that you use. Non Thread Safe versions of the accelerators available on this page have their names with the suffix "_nts".

Is my PHP compiled with Thread Safety? You can check it by executing phpinfo() function.

Thread Safety

VC6 or VC9

PHP extensions can by compiled by various compilers. For windows users they can be:

  • Microsoft Visual C++ 2008 (VC9)
  • Microsoft Visual C++ 97 (VC6)
  • Cygwin
  • others

On the http://windows.php.net/ page we can find a suggestion that we should not use PHP compiled with VC9 together with Apache webserver from apache.org. The PHP developers suggest also to use PHP VC9 versions with IIS. VC9 is newer, faster and more stable so if you can, then use it.

What about extensions? From my experience, IIS with PHP 5.3.2 compiled with VC9 and using FastCGI works well with eAccelerator 0.9.6.1 compiled with VC6 and VC9.

Which compiler is PHP I use compiled with? You can check it by executing phpinfo() function.

Compiler version

When PHP accelerator doesn't improve performance?

It happens when PHP is installed as CGI interface. In case of CGI, PHP process is loaded into memory and executed on each request to php file on a web server. In that circumstances PHP doesn't have access to shared memory from previous execution of the cached script because mamory after previous execution was freed.

PHP must be installed as a module in case of Apache. IIS can run PHP as ISAPI module, CLI, CGI or FastCGI. Every ISAPI module is running 'in-process' and it uses the same memory space as PHP interpreter so we can use PHP accelerators. People of PHP are going to resign from ISAPI version because of its instability. It's a pitty because it was the fastest version of PHP for IIS. Microsoft FastCGI for IIS loads into the memory a few instances of php for configurable time. In that case we can take advantage of PHP accelerators.

What kind of server API do I have installed? You can check this by executing phpinfo() function.

Server API

How to get to know which version of compiler was used to create my extension?

You can use the free tool called Dependency Walker (depends.exe). This is a small but a very useful program. Download it from the page http://www.dependencywalker.com/. It doesn't require installation. Execute, clik open and select the dll file of your extension. In the top left panel you will see the list of libraries required to load extensions library. If the dll is compiled with Visual C++ then on the first level among the required libraries you will find one of a msvcrt.dll versions. Here list of them and apropriate compilers.

  • Visual C++ 6 uses msvcrt.dll
  • Visual C++ 2002 uses msvcr70.dll
  • Visual C++ 2003 uses msvcr71.dll
  • Visual C++ 2005 uses msvcr80.dll
  • Visual C++ 2008 uses msvcr90.dll
  • Visual C++ 2010 uses msvcr100.dll
  • Visual C++ 2012 uses msvcr110.dll

You may also get to know if extension is compiled with Thread Safety or not. One of the required libraries may be php5ts.dll that contains Thread Safety or php5.dll the Non Thread Safe version.

Contact
Sponsors
hosted by FRESHgroup.pl | TYPO3