OpenLiteSpeed is a lightweight, high-performance web server that is gaining popularity among developers. It is easy to install and use, and it can handle a large number of requests with ease. One of the most useful extensions for OpenLiteSpeed is X-Debug, which is a powerful debugging tool for PHP. In this article, we will go through the steps required to install X-Debug on an OpenLiteSpeed server.
Step 1: Download X-Debug
The first step in installing X-Debug is to download the latest version of the extension from the official website. You can use the following command to download the file:
wget https://xdebug.org/files/xdebug-3.2.1.tgz
Once the download is complete, extract the contents of the file using the following command:
tar -xvzf xdebug-3.2.1.tgz
Step 2: Install Required Packages
Before we can compile and install X-Debug, we need to install some required packages. In this example, we will be using lsphp81-dev, autoconf, and automake. You can install these packages using the following command:
apt-get install lsphp81-dev autoconf automake
Step 3: Configure and Install X-Debug
Now that we have downloaded X-Debug and installed the required packages, we can configure and install the extension. First, navigate to the X-Debug directory using the following command:
cd xdebug-3.2.1
Next, we need to generate the configuration files for our PHP installation. In this example, we will be using lsphp81, but you may need to adjust the path depending on your installation. Use the following command to generate the configuration files:
/usr/local/lsws/lsphp81/bin/phpize
You should see below result
/usr/local/lsws/lsphp81/bin/phpize
Configuring for:
--------
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
Once the configuration files have been generated, we can configure and compile X-Debug using the following command :
./configure --with-php-config=/usr/local/lsws/lsphp81/bin/php-config
Once the command is finished, you can run make command as :
make
Finally, we can install x-debug by copying the compiled extension to the appropriate directory using the following command:cp modules/xdebug.so /usr/local/lsws/lsphp81/lib/php/20210902
Step 4: Enable X-Debug
Now that X-Debug has been installed, we need to enable it in our PHP configuration. First, create a new file named "99-xdebug.ini" in the "/usr/local/lsws/lsphp81/etc/php/8.1/mods-available" directory using the following command:
nano /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/99-xdebug.ini
Add the following line to the file:
zend_extension = xdebug
Save the file and exit the text editor.
Step 5: Restart OpenLiteSpeed
To apply the changes, we need to restart the OpenLiteSpeed service. Use the following command to restart the service:
service lsws-rc restart
We can verify installation using following command
/usr/local/lsws/lsphp81/bin/php -m | grep -i xdebug
We can use -i argument to see the xdebug details.
Conclusion
X-Debug is a powerful tool for PHP developers that can greatly simplify the debugging process. In this article, we have gone through the steps required to install X-Debug on an OpenLiteSpeed server. By following these steps, you can quickly and easily add this valuable extension to your development environment.
Thank you for the instructions. I tried this, but it didn't work. Must one be logged in as root user when issueing these instructions? Must one start in a particular directory?
ReplyDeleteIn my case the xdebug library was installed in /home//xdebug-3.2.1. Is this correct?
You should run commands as root or sudo user. Make sure you are in extracted folder while running phpize command.
Delete