+ Reply to Thread
Page 1 of 7
1 2 3 4 5 ... LastLast
Results 1 to 9 of 56
  1. #1
    Senior Member Surpass Staff Kayla's Avatar
    Member since
    May 2003
    Location
    Orlando
    posts
    25,235
    Gave thanks
    984
    Thanked 891 times

    [Big Changes] PHPsuexec to be implemented on new servers

    Security Precautions & Abuse Prevention:
    Implementation of PHPsuexec
    Last Updated 3/9/2006

    As you know, we like to introduce new concepts as simply as possible. The goal is always a concise explanation without room for confusion. However, explaining phpsuexec is going to have to be a long one I'm afraid.

    What is happening exactly?

    We are phasing all older servers to use phpsuexec. New servers will have it from the start (started with SH88 and Pass48 +). We will apply this change to older servers but only a few servers at a time.

    Explain what PHPsuexec is:
    On most Apache servers, PHP runs as an Apache module. This is the default way.
    This is why phishing scams (eBay/PayPal scams, online banking scams) are so rampant. Scammers scour the web for holes and it is extremely easy for them if the server they find has this type of setup. Most hosts have this setup because they do not realize *it doesn't have to be this way* and there is a better way. We have to help put a stop to this abuse and secure our servers.

    This will improve your service. How? All scripts will be executed with the account username instead of "nobody". Why is this important to us:


    If we find that some account is running malicious scripts and causing the server to crash, we can find the details quickly. No more tedious and time consuming searches through logs and comparing paths. If there is spam being sent out of the server, we can find the exact path and stop it quickly to avoid mail problems/errors on the server. We also want to be a respected role model for other hosts and most importantly, a host that you can be proud of. If you have never heard of phpsuexec before (and there's certainly a good chance that you haven't), we hope that you can welcome this and even make it a personal requirement for your hosting.

    We hope that this introduction to phpsuexec has been clear.

    Now, let's get into the ...
    PHPsuexec Details

    1. 777 Permissions
    Old setup:
    When PHP runs as an Apache Module it executes as the user/group of the webserver which is usually "nobody".
    Under this mode, files or directories that you require your php scripts to write to need 777 permissions (read/write/execute at user/group/world level). This is not very secure because besides allowing the webserver to write to the file it also allows anyone else to read or write to the file. It makes you ask yourself why has this been the default way all along?

    New setup- PHPsuexec: PHP running as CGI with suexec enabled - Your php scripts now execute under your user/group level. Files or directories that you require your php scripts to write to no longer need to have 777 permissions. In fact, having 777 permissions on your scripts or the directories they reside in will not run and will instead cause a 500 internal server error when attempting to execute them to protect you from someone abusing your scripts. Your scripts and directories can have a maximum of 755 permissions (read/write/execute by you, read/execute by everyone else).

    2. Goodbye .htaccess and Hello .ini
    Under the old Apache Module mode you were able to manipulate the PHP settings from within a .htaccess file placed in the script's directory.

    For example you could turn off the php setting "magic_quotes_gpc" with this line in .htaccess:

    php_value magic_quotes_gpc on

    With PHP running as CGI/phpsuexec, manipulating the PHP settings is still possible however it can not be done with .htaccess. Using .htaccess with php_value entries within it will cause a 500 internal server error when attempting to access the scripts. This is because php is no longer running as an apache module and apache will not handle those directives any longer.

    All php values should be removed from your .htaccess files to avoid the 500 internal server error. Creating a php.ini file to manipulate the php settings will solve this issue.

    3. About php.ini
    What is a php.ini file and how do I go about making one?

    The php.ini file is a configuration file that the server looks at to see what options have been turned on, off or set to a number different from the defaults that we have set for the server. While the name may seem advanced to those unfamiliar with it, it's simply a text file with the name php.ini

    To create a php.ini file, just open up a text editor, add in the lines you need and save the file. You can name the file whatever you wish when saving. Once done, upload the file to the directory where your script is located and then rename it to php.ini

    For example you can turn off the php setting "magic_quotes_gpc" with this line in php.ini:

    magic_quotes_gpc = no

    4. Troubleshooting
    HELP! My php script doesn't work or I have an error message.

    1. Check that the php script that you are attempting to execute has permissions of no more than 755 - 644 will work just fine normally, this is not something that will need to be changed in most cases.

    2. Check that the directory permissions that the script resides within is set to a maximum of 755. This also includes directories that the script would need to have access to also.

    3. Check that you do not have a .htaccess file with php_values within it. They will cause a 500 Internal server error, when attempting to execute the script.
    The php_values will need to be removed from your .htaccess file and a php.ini put in its place, containing the php directives as explained above.

  2. This user thanks Kayla for this great post!

    ceo (February 16th, 2008)

  3. #2
    Registered User Seasoned Poster
    Member since
    Dec 2004
    Location
    Edinburgh, Scotland
    posts
    94
    Gave thanks
    2
    Thanked 1 Time in 1 Post
    I like the sound of this. I don't like having to have 777 on some directories, as required CMS packages.
    Is there any thought as to when this will be rolled out to existing servers.? Or how much would it cost for a reseller to move to a newer server that has this installed?
    Server: Pass21

  4. #3
    Senior Member Surpass Staff Kayla's Avatar
    Member since
    May 2003
    Location
    Orlando
    posts
    25,235
    Gave thanks
    984
    Thanked 891 times
    Only servers SH88+ and Pass48+ are running in this way.

    There is not a set date for when previous servers to those will begin to change.

    In phpinfo, server API would show CGI instead of Apache.
    Add Surpass on Twitter and Facebook for great deals and contests FIRST!

  5. #4
    Senior Member Surpass Staff Kayla's Avatar
    Member since
    May 2003
    Location
    Orlando
    posts
    25,235
    Gave thanks
    984
    Thanked 891 times
    On Friday, January 27th, one of our first servers will have this change. Announcements will be posted in the server threads. We should be changing a server to phpsuexec every week or so.
    Add Surpass on Twitter and Facebook for great deals and contests FIRST!

  6. #5
    Registered User Seasoned Poster gmichel's Avatar
    Member since
    Jul 2004
    Location
    Bangkok
    posts
    34
    Gave thanks
    0
    Thanked 0 times
    Hello!

    So what about php scripts that require 777 permissions on some of their directory or files to work, such as a Forum. a photo gallery or a link exchange script?

    How will these scripts work when older servers are changed to your new setting?

    Thank you.
    gmichel in Bangkok
    www.eLottoSyndicate.com

  7. #6
    Senior Member Surpass Staff Kayla's Avatar
    Member since
    May 2003
    Location
    Orlando
    posts
    25,235
    Gave thanks
    984
    Thanked 891 times
    Quote Originally Posted by gmichel
    Hello!

    So what about php scripts that require 777 permissions on some of their directory or files to work, such as a Forum. a photo gallery or a link exchange script?

    How will these scripts work when older servers are changed to your new setting?

    Thank you.
    Folders set to 777 will just need to be set to 755 instead.

    Rules that apply to .cgi and .pl files apply to php files also. The maximum permissions permitted on directories and PHP files is 755. Failing to have permissions set to a maximum of 755 on PHP files and their installation paths, will result in a 500 internal server error, when attempting to execute them.

    Remember that all of this info is provided in the announcement itself above.
    Add Surpass on Twitter and Facebook for great deals and contests FIRST!

  8. #7
    Pirate Quartermaster Fresh Surpasser Bugs's Avatar
    Member since
    Oct 2005
    Location
    hot Atlanta (literally!)
    posts
    29
    Gave thanks
    2
    Thanked 0 times

    Re: PHPsuexec to be implemented on new servers

    Quote Originally Posted by Kayla
    Folders set to 777 will just need to be set to 755 instead.
    Kayla, I'm having trouble uploading attachments running Vbulletin (shows 'file upload failed' at very end) and I noticed I cannot get the following dir OFF OF 777!!!

    / public_html / forums / attachments / 1 /

    Must have missed this one as everything else was reduced to 755 long ago!!

    Help or Suggestions???

    Bugs
    SH86 (IP 72.29.83.114)
    The PirateXchange

  9. #8
    Skittles Super #1 DewKnight's Avatar
    Member since
    Aug 2004
    Location
    a space ship
    posts
    7,301
    Gave thanks
    119
    Thanked 242 times

    Re: PHPsuexec to be implemented on new servers

    If you can't chmod a folder, then it might be because it is owned by nobody (sometimes when software creates folders, this can happen). You can file a support ticket to have them change the ownership back to you. Then you can chmod it back.

  10. #9
    Registered User Seasoned Poster
    Member since
    Oct 2005
    Location
    Indiana
    posts
    56
    Gave thanks
    0
    Thanked 0 times

    Re: PHPsuexec to be implemented on new servers

    The last host I was with implemented this, and it failed miserably. After so many complaints and problems resolving issues, they eventually reverted back. Hopefully it goes a little smoother with Surpass.

+ Reply to Thread
Page 1 of 7
1 2 3 4 5 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts