Can't locate LWP/ in @INC - How to fix it ?

Are you facing error "Can't locate LWP/ in @INC"? 

This guide will help you.

Sometimes in the process of installing applications such as CSF in the DirectAdmin server or any other Linux distros like CentOS or Ubuntu, users get "Can't locate LWP/ in @INC" error.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Linux related issues.

In this context, we shall look into the causes of this error and how to get rid of it.

Nature of error "Can't locate LWP/ in @INC"?

When this error occurs, you will see an error message such as this:

Can't locate LWP/ in @INC (@INC contains: /usr/local/cpanel /etc/csf /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /etc/csf/ line 1798.
BEGIN failed–compilation aborted at /etc/csf/ line 1798.

Basically, this error trigger when applications such as CSF require Perl to compile and Perl is not installed on the server.

More about Perl ?

Perl is a programming language to perform tasks that would be difficult or cumbersome on the command line.

Most of the GNU/Linux distributions include Perl by default. Usually, we can invoke Perl using a text editor to write a file and then pass it to the Perl program.

Practical Extraction and Report Language was a language to scan arbitrary text files, extract, and print reports based on that information. Being a good language for many system management tasks, Perl has grown into a general-purpose programming language.

We can locate Perl wherever we choose. However, it’s best for both /usr/bin/perl and /usr/local/bin/perl to be symlinks to the actual binary.

Being popular in demand, Perl has several advantages, which includes:

i. Easy to start: It is closer to programming languages like C, C++ and thus, easy to learn.

ii. Text-Processing: Perl has high text manipulation abilities by which it can generate reports from different text files easily.

iii. Contains best Features: It contains features of different languages making it more useful and productive.

iv. System Administration: Since it has different scripting language capabilities Perl makes the task of system administration very easy.

How to fix error "Can't locate LWP/ in @INC"?

To begin, we can install Perl by running:

# perl -MCPAN -e 'install Bundle::LWP'

However, in CentOS/RHEL, we run:

# yum install perl-libwww-perl

Similarly, in Ubuntu/Debian, we run:

# apt-get install libwww-perl

We can compile Perl from the source:

# wget
# tar xvzf libwww-perl-6.06.tar.gz
# cd libwww-perl-6.06
# perl Makefile.PL
# make
# make install

[Couldn't perform the Linux Software installation? We are here for you. ]


This article will guide you on how to get rid of error "Can't locate LWP/ in @INC" which occurs in the process of installing #applications like CSF in the DirectAdmin server or any other #Linux #distros. 

libwww-perl (also known as LWP) is a collection of #Perl #modules that provide a simple and consistent programming interface (API) to the World-Wide Web.

In order to install and use this #package you will need Perl version

5.8.1 or better:

Some modules within this package depend on other packages that are distributed separately from Perl.  We recommend that you have the following #packages installed before you install


i. Digest-MD5

ii. Encode-Locale

iii. HTML-Form

iv. HTML-Parser

v. HTML-Tagset

vi. HTTP-Cookies

vii. HTTP-Date

viii. HTTP-Message

ix. HTTP-Negotiate

x. libnet

xi. LWP-MediaTypes

xii. MIME-Base64

xiii. Net-HTTP

xiv. URI

xv. WWW-RobotRules

If you want to access sites using the https protocol, then you need to

install the LWP::Protocol::https module from CPAN.

Related Post

Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx