Build Custom PHP
From OpenLiteSpeed Wiki
Revision as of 22:03, 13 December 2017 by Malegre (Removed Help Category.)
Compiling PHP is not recommended way to setup your openlitespeed web server. You should install them through either LiteSpeed or remi repository. Compiling PHP is only needed when you have some very special need.
PHP is fully supported by OpenLiteSpeed out of box. No additional configuration is required. For more on the default PHP settings, please see our article on the topic. Many users, however, will want to create their own custom PHP builds. This article will cover building a custom PHP in OpenLiteSpeed. (We will be taking you through the steps to create a PHP 5.4.17 build.)
Go to the Compile PHP utility
(WebAdmin console => Actions => Compile PHP)
Select a PHP version
Choose build options
The Install Path Prefix designates the location the PHP executable will be built. (It is equivalent to
'--prefix=' in the mod_php build options.) This setting is important because this is where your php.ini will be and where extensions should be installed.
Configure Parameters and Add-on Modules allow you to choose needed compile options and modules.
Build PHP 5.4.17
Once the build is complete, OpenLiteSpeed automatically copies the PHP executable to
$SERVER_ROOT/fcgi-bin? and creates a new
$SERVER_ROOT/fcgi-bin/lsphp5 symlinked to the new PHP executable. This is done because the default PHP external application is set to read from
$SERVER_ROOT/fcgi-bin/lsphp5. By using these symlinks instead of overwriting, our new build is automatically used by the default external applications and we do not have to change the location specified in the External Application settings, but we are still able to quickly revert back to our previous build (just change the symlink) if something goes wrong.
You can run the
./lsphp5 -v command to see the new version number.
For further verification, point your browser to your phpinfo page and check all your configurations.