Build Custom PHP only when you have special need

How Can We Help?
< Back
You are here:
Print

 

Compiling PHP is not recommended way to setup your openlitespeed web server and most of the users don’t need to compile PHP at all. You should install LSPHPs through either LiteSpeed or remi repository. In some very rare situation, a user may need to compile PHP when he have some very special need. This article will give a brief introduction about PHP compiling function in OpenLiteSpeed Web Admin Console. (We will be taking you through the steps to create a PHP 5.4.17 build.)

Building PHP is a big topic. If you run into any PHP compiling error, please google it yourself or ask on PHP forum. OLS provides a GUI interface for PHP compiling on OLS Web Admin Console but building PHP itself is actually our of scope and is beyond web server’s support.

Go to the Compile PHP utility

(WebAdmin console => Tools => Compile PHP)

Select a PHP version and click NEXT.

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 7.2.5

Verify

Once the build is complete, OpenLiteSpeed automatically copies the PHP executable to $SERVER_ROOT/fcgi-bin? and creates a new $SERVER_ROOT/fcgi-bin/lsphp7 symlinked to the new PHP executable. This is done because the default PHP external application is set to read from $SERVER_ROOT/fcgi-bin/lsphp7. 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 ./lsphp7 -v command to see the new version number.

For further verification, point your browser to your phpinfo page and check all your configurations.

xx