The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Permission errors

Discussion in 'Database Discussions' started by morphina, Jan 15, 2006.

  1. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi, i have php running as cgi; I tried running php as a module not as cgi to be able to use eaccelerator; and I keep getting permission files on the scripts that need to acess textfiles for configuration; what could be the problem?
     
  2. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator

    can you explain more .. or rather clearly.
     
  3. jmoe2008

    jmoe2008 Member

    Joined:
    Jan 18, 2005
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    I think the problem is that PHP running as a module runs as nobody, but with CGI it runs as the correct user. So the permissions errors are from the files being owned by the user rather than PHP and using something like 644 as the permissions. CHMODding the files to 666 should fix the problems, or enabling suexec.
     
  4. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    sure, sorry if it was a bit unclear.

    I Have php running as CGI, http://www.lasnite.com/test.php <-- phpinfo
    I have some php scripts for my website that require access to read and write to text files, such as featured pictures, etc..., when I run php as an apache module php gives out errors saying it cannot access these files. but the scripts actually do work; it runs php well, it just wont read or write to these files... it does it fine when php is in CGI mode...

    sorry, suexec has also been enabled and the problem sill persists; WHM enabled it by default... i'll try chmodding to 666, should I chmod the text files to view the featured pics, or the php script reading and writing t othese files?
     
    #4 morphina, Jan 15, 2006
    Last edited: Jan 15, 2006
  5. jmoe2008

    jmoe2008 Member

    Joined:
    Jan 18, 2005
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    The files that you want to read, but with suexec enabled it shouldn't be a problem. Suexec runs PHP as the user of the directory which means 644 should be sufficient for permissions. I think there are a couple places you have to turn suexec on to actually have it fully enabled. Try changing the files that you need to write to 666 to see if PHP as a module can then read/write them.
     
  6. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Warning: fopen(/home/morphina/public_html/boston/gallerygain/albums/Villareal111205/photos.dat.lock): failed to open stream: Permission denied in /home/morphina/public_html/boston/gallerygain/platform/fs_unix.php on line 55

    I still get the errors even after chmodding the files to 666
     
  7. jmoe2008

    jmoe2008 Member

    Joined:
    Jan 18, 2005
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    I seem to be making a slight confusing statement. When I say suexec I'm referring to php_suexec not suexec for CGI. That might make a slight difference. As far as I know WHM doesn't default to using php_suexec, which means that you would need to use 666 for permissions for files accessed by PHP running as a module.

    Do you know what user PHP is running as, and also what user and group owns the files you're trying to read?
     
  8. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    yes it mislead me to thin we wre talking about suexec for cgi, you meant php_suexec; apache is runing as nobody and no, php_suexec is not enabled, should I do that? the user that owns those files is morphina and has its own group, which is how I think cpanel creates it. when as an apache module, the websites load fine, its just having trouble with those particular files for some reason...
     
  9. simplestar

    simplestar Well-Known Member

    Joined:
    Nov 15, 2005
    Messages:
    97
    Likes Received:
    0
    Trophy Points:
    6
    As far as I know, the permissions should be 644 and 755 if you want them read/execute
     
  10. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    it wont do it :S, it also happens with teh configuration file for mambo since it needs to write to it, i noticed it has no trouble reading from it, its always when its oging to write to it...
     
  11. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    has anyone ever seen this problem before?

    i tried settting the permissions to 666 and nothign works :S; is there a cacheing extension that works when php is in cgi mode?
     
  12. PDM

    PDM Active Member

    Joined:
    Jan 7, 2004
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Angel Fire, NM
    php_suexec should fix it.
     
  13. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    where do I read about php_suexec? and is it possible to enable it and disable it upon wish will? :), i guess what im asking is whre can I read abotu how to enable it :P
     
  14. PDM

    PDM Active Member

    Joined:
    Jan 7, 2004
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Angel Fire, NM
    Search the forums there are several good threads on it.

    It seems to me any cPanel server not running php_suexec, expecially in a shared hosting environment, is far more vulnerable to exploit :rolleyes:
     
  15. morphina

    morphina Member

    Joined:
    Aug 31, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    hmm, i read about phpsuexec and it seems that phpsuexec will only run while php is in cgi mode wont it? which defeats th epurpose of me trying to run it as a module cuase i wanna get that good ol' eaccelerator up and running :(
     
  16. Kerstin

    Kerstin Well-Known Member

    Joined:
    Apr 9, 2005
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Berlin
    Have php_suexec or exec of CGI sipts in Browser somthing to do with the error ?

    I think CGI and PHP are some different fuctions, maybe some bowser ;) or system settings.

    I think browsing the forum or the database is maybe meaningful :eek:

    or maybe a script error ;) in the scipt database of the connected server.
     
    #16 Kerstin, Jan 19, 2006
    Last edited: Jan 25, 2006
  17. djmerlyn

    djmerlyn Well-Known Member

    Joined:
    Aug 31, 2004
    Messages:
    203
    Likes Received:
    1
    Trophy Points:
    16
    the script you're trying to run (that gallery script) never makes the dat.lock files correctly.

    They need to be CHMOD 777.

    Why you are asking here and not in your venders forums is beyond me...

    phpsuexec doesn't really help much with a .dat.lock file (those aren't PHP!) :p
     
  18. PDM

    PDM Active Member

    Joined:
    Jan 7, 2004
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Angel Fire, NM
    With php_suexec enabled on the server Gallery installs and works fine without chmodding anything because php runs as the user and the user owns the file.

    Running apache with php_suexec is far more secure than without and all the popular open source scripts like Gallery, Coppermine, Mambo, Joomla, PHPNuke, etc. install and run without any chmod of files or folders.

    IMHO it should be the default cPanel configuration ;)
     
Loading...

Share This Page