104 reputation
17
bio website
location
age
visits member for 3 years, 1 month
seen Jan 22 at 23:32

Jan
22
comment How to set custom $_SERVER variable for PHP
Thanks but remember the challenge isn't distinguishing CLI vs Apache. It's distinguishing which server either are running on.
Jan
22
comment How to set custom $_SERVER variable for PHP
Thanks but that doesn't help me know WHICH server I'm on. The challenge isn't distinguishing CLI vs Apache. It's distinguishing which server either are running on.
Jan
22
comment How to set custom $_SERVER variable for PHP
Like a flag in the command? '... -env dev'
Jan
22
comment How to set custom $_SERVER variable for PHP
@Sven I was hoping the shell script could look at... something... which would differentiate the remote environment from my local. For example, the app locations differ, so I considered checking against $_SERVER['PHP_SELF'], which seems to be available in the shell. But it felt really hacky... but maybe that's the best option?
Jan
22
awarded  Scholar
Jan
22
accepted PHP script needs permission to run a sudo command with shell_exec()
Jan
22
asked How to set custom $_SERVER variable for PHP
Aug
3
awarded  Notable Question
Mar
15
awarded  Supporter
Oct
13
awarded  Popular Question
Aug
29
awarded  Commentator
Aug
29
answered MAMP Vhosts Slow
May
29
awarded  Tumbleweed
Dec
12
revised PHP script needs permission to run a sudo command with shell_exec()
Added updated sudoers file
Dec
12
comment PHP script needs permission to run a sudo command with shell_exec()
I actually tried this, and for some reason it didn't work with the full path. I've got it working currently, but with this: Emerson ALL=(ALL) NOPASSWD: ALL I'm not happy about it because it seems too permissive to be safe. Am I wrong about that?
Dec
12
revised PHP script needs permission to run a sudo command with shell_exec()
Added new test resutls
Dec
12
comment PHP script needs permission to run a sudo command with shell_exec()
Update. It still didn't work. I still have to open/re-save etc/sudoer to keep my script working. It sounds like the requiretty flag should be off by default anyway.
Dec
12
comment PHP script needs permission to run a sudo command with shell_exec()
Update. It didn't work with username. I'm testing it as follows: Defaults:www-data !requiretty
Dec
12
comment PHP script needs permission to run a sudo command with shell_exec()
I don't have a /var/log/auth.log but I do have a /var/log/secure.log. I took a look at the entries from the past 36 hours. Nothing seems to be relevant, but I'm also not sure what I should be looking for? Would it be appropriate to add the contents to my post?
Dec
12
comment PHP script needs permission to run a sudo command with shell_exec()
I just want to make sure I understand your code. Is the colon at the end of "Defaults:" correct? Your syntax is a bit different than the other defaults in my current file. Also, is "username" a placeholder for an actual username? Like www-data? Sorry if these are dumb questions. My understanding of this syntax is poor.