Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th November 2006, 21:25
marra87 marra87 is offline
Member
 
Join Date: Sep 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Permission denied when running scripts from php

Hi!

I have some problems.
I'm kind of n00b, so hope you can help!

I have a Fedora server with Apache and PHP.
But I get a permission denied when I'm running a script from the webbrowser.
Here is my PHP code:

Code:
function execute($command) { 
    $command .= ' 2>&1'; 
    $handle = popen($command, 'r'); 
    $log = ''; 
    while (!feof($handle)) { 
        $line = fread($handle, 1024); 
        $log .= $line; 
    } 
    pclose($handle); 
    return $log; 
} 

echo execute("wakeonlan 00:04:61:6B:A4:71");
Output: socket : Permission denied at /usr/bin/wakeonlan line 78.

What permissions do I have to set? Thanks
Reply With Quote
Sponsored Links
  #2  
Old 16th November 2006, 16:05
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

What's the output of
Code:
ls -l /usr/bin/wakeonlan
?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 16th November 2006, 16:07
marra87 marra87 is offline
Member
 
Join Date: Sep 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[root@localhost ~]# ls -l /usr/bin/wakeonlan
-r-xr-xr-x 1 root root 5318 okt 27 01:41 /usr/bin/wakeonlan
Reply With Quote
  #4  
Old 17th November 2006, 14:48
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

What happens if you run
Code:
chmod 777 /usr/bin/wakeonlan
?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 18th November 2006, 01:02
cougar19 cougar19 is offline
Junior Member
 
Join Date: Nov 2006
Location: New Mexico
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greetings,

I am having a similar problem. I've created a script that reads a template file then creates and posts the template into a new file using fopen but it returns with "fopen(/usr/web/bsu/test.php): failed to open stream: Permission denied in /usr/web/bsu/admin/includes/functions/content.php on line 134"

I've double checked the /usr/web/bsu directory and it's permissions are set to 777.
Are there any other permissions that need to be set for this kind of action?
Reply With Quote
  #6  
Old 18th November 2006, 04:04
mudder-board mudder-board is offline
Junior Member
 
Join Date: Nov 2006
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hope this is of some use, if you want to change permissions for the entire folder and its contents, you would do this
Code:
chmod 777 /directory name -R
otherwise just do
Code:
chmod 777 /directory/file.php
Your permissions may differ, 777 was only for an example
Reply With Quote
  #7  
Old 18th November 2006, 15:33
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

Also make sure you disabled PHP Safe Mode.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #8  
Old 18th November 2006, 16:47
cougar19 cougar19 is offline
Junior Member
 
Join Date: Nov 2006
Location: New Mexico
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The folder and files are already 777 and PHP safe mode is disabled.
I've even gone so far as to try chown on the directory to apache to see if the PHP group needed permission but still didn't work
Reply With Quote
  #9  
Old 19th November 2006, 00:45
cougar19 cougar19 is offline
Junior Member
 
Join Date: Nov 2006
Location: New Mexico
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Finally got it. For those with a similar problem. Check SELinux enforcing parameters.

/etc/selinux/config
Line 6: SELINUX=enforcing
Change
Line 6: SELINUX=disabled
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 09:29
Slightly Confused (DNS & Server Help) JohnnyBGoode Installation/Configuration 26 14th August 2007 09:54
php script injections Grizzly General 21 18th July 2006 08:55
Questions in regards to ISP-Server Setup - Ubuntu 5.10 "Breezy Badger" rbrantley HOWTO-Related Questions 16 10th April 2006 18:26
Downgrade php5 to php4.4.2 llizards Installation/Configuration 4 13th March 2006 23:58


All times are GMT +2. The time now is 11:13.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.