Can't locate Cpanel/AddonDomain/addaddondomain.pm in @INC
AnsweredHello
I checked the forum but couldn't find a solution.
I'm trying to create an Addon Domain from the command line using cpapi2 as explained here: https://api.docs.cpanel.net/cpanel-api-2/cpanel-api-2-modules-addondomain/cpanel-api-2-functions-addondomain-addaddondomain/
I installed the module in WHM > Module Installer I installed "API::CPanel::Domain (0.09)"
Also, I tried to install via the command line but it return an error:
# /usr/local/cpanel/scripts/perlinstaller AddonDomain::addaddondomain
Checking C compiler....info [perlinstaller] /root/.cpanel/datastore/Cpanel::Sys::Compiler::test_compile_gcc
C compiler (/usr/bin/gcc) OK (cached Tue Feb 13 09:34:47 2024)
Tuned C compiler not available because it is not enabled....Done
Method: Using cpanminus
cpanm (App::cpanminus) 1.9019 on perl 5.016003 built for x86_64-linux-thread-multi
Work directory is /home/.cpanm/work/1707839463.27626
You have make /usr/bin/make
You have LWP: 6.05
You have /usr/bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching AddonDomain::addaddondomain () on cpanmetadb ...
! Finding AddonDomain::addaddondomain on cpanmetadb failed.
Searching AddonDomain::addaddondomain () on metacpan ...
! Finding AddonDomain::addaddondomain () on metacpan failed.
Searching AddonDomain::addaddondomain on mirror http://www.cpan.org ...
! Finding AddonDomain::addaddondomain () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution AddonDomain::addaddondomain
cpanminus failed with non-zero exit status: 1
If i run cpapi2 help, it returns:
# cpapi2 --help
The following calls are available:
AddonDomain::addaddondomain
AddonDomain::deladdondomain
AddonDomain::listaddondomains
Backups::listfullbackups
So the "AddonDomain" option exists.
But when I run:
# cpapi2 AddonDomain::addaddondomain dir=%2Fpublic_html%2F newdomain=minewdomain.com subdomain=www --user=myuser
I get this error:
[2024-02-11 19:26:37 -0500] warn [Internal Warning while parsing unknown 15809] Error loading module AddonDomain::addaddondomain - Can't locate Cpanel/AddonDomain/addaddondomain.pm in @INC (you may need to install the Cpanel::AddonDomain::addaddondomain module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/536/cpanel-lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/cpanel-lib /usr/local/cpanel/3rdparty/perl/536/lib/x86_64-linux /usr/local/cpanel/3rdparty/perl/536/lib /opt/cpanel/perl5/536/site_lib/x86_64-linux /opt/cpanel/perl5/536/site_lib) at (eval 2) line 1.
Not sure how to proceed, I also tried setting
export PERL5LIB=/usr/local/share/perl5
export PERL5OPT=/usr/local/share/perl5
because that is the supposed location of the module, but it didn't work.
The question is, how can I use the cpapi2 AddonDomain::addaddondomain feature?
Thanks!
-
Hey there! You should not need to manually install any additional tools to use the cPanel API. Here is the call for the command line version to add an addon domain, along with output indicating is successfully performed the operation:
cpapi2 --user=username AddonDomain addaddondomain dir=/home/username/public_html/addonapitest newdomain=addonapitest.com subdomain=addonapi
---
cpanelresult:
apiversion: 2
data:
-
reason: The system successfully parked (aliased) the domain “addonapitest.com” on top of the domain “addonapi.domain.com”.
result: 1
event:
result: 1
func: addaddondomain
module: AddonDomain
postevent:
result: 1
preevent:
result: 11 -
awesome, this works, I really don't know how I complicated matters so much.
Thank you!
0 -
I'm glad that's working well now!
0
Please sign in to leave a comment.
Comments
3 comments