• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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