• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

how to run subdomain.sh from PHP

D

deem7

Guest
HI,
I'm trying to create/delete subdomains from a PHP script (executed from web). Until now all my attempts have failed :(

(AFAIK there is no way to create/delete subdomains through the sdk api?)

I tried sudo and it didn't work. I wrote a C program which run subdomain.sh, and gave it root uid and gid and it doesn't work either.

Is there any special protection in subdomain.sh against being called from web?

How to overcome it?
 
Ok, problem solved :)
sudo and C program were OK, my problem was somewhere else.
 
Hoping you are still around. I am having a sitution where sudo command line from php is not working. Apache id is being blocked from running the command from what I can tell. Is this what you experienced? What was your solution?
 
Hi, I don't know what can be the cause of your problem. In my case everything worked fine but the Plesk script printed everything to strerr instead to stdout. So the php command "system()" returned nothing and I thought it didn't work.

All I can do is to give you my current configuration which works:

file /etc/sudoers - add line:
apache ALL= NOPASSWD: /usr/local/psa/bin/subdomain.sh

and this is what I run from php:
system("/usr/bin/sudo /usr/local/psa/bin/subdomain.sh -c $subdomain -d $domain -ftp_user native -lo
gin $subdomain -passwd $password -php true 2>&1");

this creates a subdomain with given parameters.

best regards
deem
 
Back
Top