Step-by-Step Guide to Install and Enable cURL in LiteSpeed Web Server

Introduction

cURL is commonly required by PHP applications to communicate with external services over HTTP and HTTPS. If the PHP version used by LiteSpeed Web Server does not have the cURL extension enabled, applications may display errors or fail to connect to external APIs and services.

In LiteSpeed Web Server, cURL is enabled by compiling the PHP build with the --with-curl option. This guide explains how to recompile PHP with the cURL extension and verify that it has been successfully enabled.

Prerequisites

Before proceeding, make sure you have:

  • Root or sudo access to the LiteSpeed server.
  • LiteSpeed Web Server installed and running.
  • PHP source code available on the server.
  • A working PHP build environment.
  • The required cURL development libraries installed.
  • A backup of the existing PHP/LiteSpeed configuration.
  • Sufficient disk space to compile PHP.

Implementation

Installing cURL in LiteSpeed is a very easy process. You can compile PHP with cURL support in the LiteSpeed Web Server using the simple method shown below.

Follow the steps below to install cURL in the LiteSpeed Web Server.

1) Go to the lsws directory

cd /opt/lsws/phpbuild/php-5.2.6/

2) Check the compiled modules in LiteSpeed and check the current status.

cat config.nice
cat config.status
cat config.nice

3) Now, you need to recompile LiteSpeed with the cURL module.

./configure –prefix=/opt/lsws/lsphp5 –with-litespeed –with-config-file-path=../php –with-mysql=../mysql –with-zlib –with-zlib-dir=.. –with-gd –with-jpeg-dir=.. –with-png-dir=.. –enable-shmop –enable-track-vars –enable-sockets –enable-sysvsem –enable-sysvshm –enable-magic-quotes –with-curl=/opt/curlssl/

make
make test
make install

Once the installation is complete, you can check the compiled modules using the following commands:

/opt/lsws/lsphp5/bin/php -m
/opt/lsws/lsphp5/bin/php -i | grep curl

That’s it. LiteSpeed is now compiled with the cURL module.

Conclusion

By following the above steps, you can successfully compile and enable the cURL module in PHP for the LiteSpeed Web Server. After completing the installation, verify the cURL module using the provided commands. If cURL support is displayed as enabled, the installation has been completed successfully.

FAQs

1. How do I check if cURL is enabled?
Run: /opt/lsws/lsphp5/bin/php -m | grep curl

2. Do I need to restart LiteSpeed?
Yes, restart LiteSpeed after enabling cURL.

3. Can I enable cURL without recompiling PHP?
Yes, if a compatible cURL PHP extension package is available.

How to install OpenLiteSpeed on Ubuntu 18.04 / 20.04 Server

Install LiteSpeed in WHM

Talk to our experts:

Looking for the right technology solution for your business?. Our experts can help with web hosting, domain registration, DevOps and cloud, software development, web applications, mobile applications, and enterprise solutions. Get in touch with our team here.

admin

Writes about Web & Architecture at Pheonix Solutions.

Leave a Reply

Scroll to Top