• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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