Hello there,
I am installing this piece of software for my client, and he wants to use CentOS Web Panel, which I must admit - looks better than at first I was hoping it to be.
We're having this issue, where the PHP/BASH software is always failing due to:
wget: command not found
ls: command not found
etc..
Since the server is working well, I begun to go after HTTPD processes.
[root@server ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@server ~]# ps faux | grep httpd
root 31870 0.0 0.0 103356 856 pts/0 S+ 09:35 0:00 \_ grep httpd
root 9332 0.0 0.0 59168 3684 ? Ss 07:26 0:00 /usr/local/apache/bin/httpd
nobody 17413 0.0 0.0 59536 3472 ? S 08:25 0:00 \_ /usr/local/apache/bin/httpd
[root@server ~]#
So httpd forks run as nobody, okay. So I checked if nobody sees linux paths.
[root@server ~]# su nobody -s /bin/bash
bash-4.1$ wget
wget: missing URL
[root@server ~]# su nobody -s /bin/bash
bash-4.1$ echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
bash-4.1$
So the user 'nobody' seems okay in itself. So this problem is somewhere between PHP and the interfacing with the Linux user.
I tried to use:
<?php
print shell_exec( 'whoami' );
?>
But the window is empty, same command works well on any other server and returns the active user.
Additionally, if we override the scripts, by setting a PATH variable in the script, commands such as wget are found, but ls and $HOME paths seem loose info somewhere.
if [ "$(ls -I '^.' $HOME/$tpl_file_path)" == "" ]
When ran via the browser - it gets a false, i.e. no files exist in the folder. If we do this from the nobody user - it returns a proper dir listing (with files existing)
Anybody could give some tips on what to do? Been working on this for 3 hours with no further results. PHP Info is here: http://tinyurl.com/pgft6mo
Cheers.
Also, I would like to add that the scripts themselves are bash scripts, example names are:
CreateServer
(without .sh at the end).
These are started by the web server from a php based website.
Hello.
In the file:
/usr/local/etc/suphp.conf
change the line:
env_path=/bin:/usr/bin:/usr/local/php/bin
to:
env_path="/bin:/usr/bin:/usr/local/php/bin"
It should help to you.
Hello Igor,
This seems to made it work!
Could you please elaborate? What was the issue in suPHP? How did those quotes help out and how did you know?
Either I am too tired to figure it out, or its a bit tricky.