have written a perl script that adds info to the apache httpd.conf file on a linux server. It runs fine from the command line when logged in as root, but I want to be able to run this file from a web browser. I have Cpanel installed on the server - cpanel has its own way of "remotely" allowing you to Create and Delete Accounts etc from a web browser using its Accounting module.
http://www.cpanel.net/remoteaccess-php.html
I made a copy of the accounting module file, and added my own function to it, using the cpanel format as a test to just add a line of text to a sample file owned by root.
Here is an example of one of Cpanels functions
Here is mine:
Both functions execute a perl script located in the scripts folder. Mine is executable and as i say, works fine from the command line. Also I can run their functions just fine like creating an account.
Any ideas why it doesnt work? Do I need to register my script with cpanel, or do they have a list of authorized 3rd party scripts that can be run through port 2086 in their whmreq script? Or does anyone have another idea how to do what i want to do?
This is all that is in my script
----------------------------------------------------------
#!/usr/bin/perl
system (`echo "hello world" >> "/etc/testfile"`);
----------------------------------------------------------
http://www.cpanel.net/remoteaccess-php.html
I made a copy of the accounting module file, and added my own function to it, using the cpanel format as a test to just add a line of text to a sample file owned by root.
Here is an example of one of Cpanels functions
PHP:
function createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan) {
$result = whmreq("/scripts/wwwacct?remote=1&nohtml=1&username=${acctuser}&password=${acctpass}&domain=${acctdomain}&plan=${acctplan}",$host,$user,$accesshash,$usessl);
if ($cpanelaccterr != "") { return; }
return $result;
}
PHP:
function testscript ($host,$user,$accesshash,$usessl) {
$result = whmreq("/scripts/testscript",$host,$user,$accesshash,$usessl);
if ($cpanelaccterr != "") { return; }
return $result;
}
Any ideas why it doesnt work? Do I need to register my script with cpanel, or do they have a list of authorized 3rd party scripts that can be run through port 2086 in their whmreq script? Or does anyone have another idea how to do what i want to do?
This is all that is in my script
----------------------------------------------------------
#!/usr/bin/perl
system (`echo "hello world" >> "/etc/testfile"`);
----------------------------------------------------------