• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

PHP & sudo

L

lhenor

Guest
I recently upgraded a server from 7.0.4 (FreeBSD) til 7.5.3 (FreeBSD). Most of of the existing data where transferred through PMM sucessfully.

However, my registration scripts are no longer working. They are simple php calls to sudo shell scripts.

What have been changed and how can I do s simple workaround for this problem.

Thanks
LheNor
 
Make sure that there is no PHP safe_mode issue. What do you get on the screen from the PHP page?
 
When i try to run a sudo script I get nothing back from the exec command. However, if I run a simple 'whoami' command I get return..

PHP safe_mode is off. I guess I should switch safemode on, but I have not touched the config for this domain since v.7.1.x

Any ideas? - I am stuck here...
 
If safe_mode is off is ok. The problem is in the script, not in PHP. Are you sure that apache has permissions to execute the script? Have you checked the server error_log?
 
I have simple test script which tries to exceute the domain creation utility.
For testing purposes I have granted everyone sudo rights.
I am using full paths to execute the scripts.

Exactly the same scripts worked at the old server.

Example;

php: shell_exec("./domainCreate.sh");

script;

#!/bin/sh
sudo-u root /usr/local/psa/bin/domain.sh $*
#echo $* >> /usr/autosys/psa/domains/data
 
After some futher test it seems that it is the domain creation utility that is working..

I created a root runnable script and sucessfully ran the script from php using sudo command.. whoami also show root..

How can I workaround this issue?
The client have access to php...
 
Back
Top