/    Sign up×
Community /Pin to ProfileBookmark

PHP Sudoers and CHOWN

I’m having a heck of a time chowning files through php…

php’s chown function didn’t work, so i’m trying to use:
exec(“sudo chown root /filename.txt”);
and it’s not working.

exec(“whoami”) confirmed that php is running as the user “apache”…
so i added the following to my sudoers file:
apache ALL NOPASSWD: ALL

and it’s still not working. i have no idea what else to check for, does anyone else have any other ideas?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyApr 21.2006 — Have you checked the [url= http://au3.php.net/manual/en/function.chown.php]php manual[/url]?
Copy linkTweet thisAlerts:
@omegaplusauthorApr 21.2006 — Have you checked the [url= http://au3.php.net/manual/en/function.chown.php]php manual[/url]?[/QUOTE]

yeah...
Copy linkTweet thisAlerts:
@omegaplusauthorApr 21.2006 — for any of those interested, here's what I did to fix the problem.

the problem was the sudoers file.

I didn't edit the sudoers file with [B]visudo[/B], so there were "syntax errors" with the file.

so...

I opened the file with [B]editpadpro[/B] (a GREAT program), and [B]removed all of the UT8 stuff[/B]. I reuploaded it to the server and then opened it with visudo to check for errors and that seemed to do the trick.
×

Success!

Help @omegaplus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...