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.

Fixing Old 777 Reliant Scripts to Work With suphp

Discussion in 'General Discussion' started by Doug E, Mar 28, 2010.

  1. Doug E

    Doug E Well-Known Member

    Aug 17, 2005
    Likes Received:
    Trophy Points:
    I'm looking for articles, threads or advice on making old scripts once reliant on 777 permissions be able to run with suphp.


    Today I found my wordpress blog was unable to install plugins automatically, a common permissions problem with user 'nobody' apparently. As I intend to install wordpress blogs on quite a few domains on my server I thought it best to fix this problem. So I recompiled? apache to include suphp. Wordpress plugins install automatically now. All is good, for wordpress.

    When I first read about this fix it was mentioned a lot of old scripts reliant on 777 permissions would be a problem when using suphp. For me everything server is a problem so I went ahead anyway thinking it would be a simpler fix than its turning out to be.

    The script tracks clicked outlinks from a webpage and at first these outlinks would not load, I would be given a 500 error. So I adjusted the 777 files and folders to 755 on each page and the scripts webpage behaviour works now. Most of the pages are .html set by htaccess to behave as .shtml, the rest are just .shtml. (I then found I needed to have zend optimizer installed and it wasn't included in the newest version of apache I upgraded to, I downgraded/recompiled and fixed this)

    The script is installed on multiple domains on my server but has a main installation on one domain from which a central control panel is accessed. I am unable to load that control panel in a browser, I get the 500 errors. I went through and by hand modified all permissions to 755 for the hundreds of files and folders that were 777 but I'm still unable to load this scripts control panel. It is possible I missed a few files in the dozens of folders but the main root folders/files are all 755. (I have a separate thread here asking how to do a search for 777 files as its near impossible to do by hand)

    Not sure if this helps but one of the components? of this script seems to be phpmyadmin as there is a folder in the scripts root/control panel install location for it.

    Anyways, lots of useless info above, I'm sure, but I wanted to include it as I don't know enough to know what is important or not. My appreciation to anybody with the patience to read through it :)
  2. thewebhosting

    thewebhosting Well-Known Member

    May 9, 2008
    Likes Received:
    Trophy Points:
    You will have to check the logs for the exact error message.
  3. handsonhosting

    handsonhosting Well-Known Member

    Feb 17, 2002
    Likes Received:
    Trophy Points:
    Omaha, NE
    cPanel Access Level:
    Root Administrator
    here's a couple of commands to help you out;

    cd /directory/base
    find . -type d -exec chmod 755 {} \;
    find . -type f -exec chmod 644 {} \;

    That will change all direcotries to 755 and all files to 644. Be sure you're inside the /home/user/public_html (or sub folder thereof) or you'll royally screw your system :)

    Only change specific file extensions
    find . -iname "*.gif" -o -iname "*.jpg" -exec chmod 644 {} \;

    In this one, we're finding files with the extension "gif" or "jpg" and setting the permissions to 644

    You had mentioned that you had an issue with username permissions, so give this a shot too;

    find . -type d -exec chown cpusername.cpusername {} \;
    find . -type f -exec chown cpusername.cpusername {} \;

    Again, like above, make sure you're in the right folder, as it will do all folders from the directory you're in, and navigate through all subfolders.

    I use these commands on a regular basis for various scripts such as X-Cart and Magento in order to change permissions to work correctly on a SuPHP enabled system.

    Once you do that, you MAY have issues with some of your scripts as they have LOG folders or files that they write to for logs, so you'll need to reset those permissions back to 777 or 666 as needed. You'll be able to tail the error_log file for apache and see what files are having permission errors and then address accordingly.

    Hope that helps!

Share This Page