Looking for a way to compile PHP within the OpenLiteSpeed web server?
OpenLiteSpeed supports PHP out of the box. However, users may have to compile PHP for the working of specific applications.
At Bobcares, customers often to approach us to compile custom PHP in OpenLiteSpeed, as a part of our Server Management Services.
Today, we’ll see how our Support Engineers compile PHP using the OpenLiteSpeed admin panel.
PHP in OpenLiteSpeed
OpenLiteSpeed is an open-source version of the LiteSpeed webserver. And PHP is a scripting language used to provide dynamic web pages. OpenLiteSpeed supports PHP without any additional configuration.
Also for optimum performance, OpenLiteSpeed recommends using the PHP from the official repository.
But some applications require additional PHP versions. In such cases, users need not have to manually compile it. OpenLiteSpeed admin interface makes this task easier. There is an inbuilt option to compile PHP.
Let’s see how our Support Engineers do this.
How we compile PHP in OpenLiteSpeed?
Let’s see the steps we use to compile PHP in the OpenLiteSpeed admin panel.
1. First login to the admin panel.
2. Then select the option Tools from the side panel. Select Compile PHP from the sub-section. The window shows the steps to compile PHP with directions.
3. In the first step, we Select PHP version, we want to compile. OpenLiteSpeed also allows compiling versions not listed there. But in this case, users have to manually update the settings in BuildConfig.php.
4. The second steps allow us to Choose Build Options. Here we will have a default Installation Path Prefix. This is where the php.ini file will be present. Also, this is the location to install extensions. We can edit the default Config Parameters too.
5. The third step to Download Source Code. This step automatically completes itself and give the status Finished successfully.
6. Finally, we Compile and Monitor PHP. For this, we have to run a script in the command line. For a root user, the script is
The script starts configuring PHP. The status can be viewed in the detailed log. Later it compiles PHP. The status appears as,
Error while configuring PHP
In some cases, the process of configuring PHP ends with an error. And the admin interface shows the error as,
Here, we check the Detailed Log. Mostly the compiling ends due to some missing dependencies. The detailed error log will give the package name that is missing. For instance, the log appears as,
configure: error: mcrypt.h not found. Please reinstall libmcrypt. **ERROR** Could not configure PHP build
Installing the missing package mentioned in the error log fixes the error. Thereafter the recompiling of PHP works again.
Finally, we check the working of PHP by adding a PHPinfo page in one of the websites on the server.
[Still, having trouble in compiling PHP in OpenLiteSpeed? – We can help you.]
So far, we saw the steps to compile PHP in the OpenLiteSpeed web server. Today, we also saw how our Support Engineers fix errors while compiling PHP.