SuPHPfix

From Cheatsheet
Jump to navigation Jump to search

suPHPfix (cPanel only) corrects common permission/ownership issues (as well as some PHP setting issues) that are commonly encountered when switching to CGI/FCGI/suPHP (with suexec enabled). suPHPfix also has the ability to restore cPanel accounts to the state they were in before it made any changes. This is useful when customers decide CGI/FCGI/suPHP (with suexec enabled) is not for them and you wish to undo/revert all changes made by suPHPfix.


Notice: suPHPfix can only restore states if --save-state was ran! See section three (Full Usage/Help) for full details.


Download/Installation

/scripts/perlinstaller JSON && /scripts/perlinstaller Linux::Ext2::FileAttributes
wget -O /scripts/suphpfix.pl http://layer3.liquidweb.com/scripts/suphpfix.pl
chmod +x /scripts/suphpfix.pl

Example Commands

Saving States

To save current permission/ownership states for all files/directories in every users WWW, run:

/scripts/suphpfix.pl --save-state all

To save current permission/ownership states for all files/directories in the 'liquidweb' cPanel accounts WWW, run:

/scripts/suphpfix.pl --save-state liquidweb


Fixing Common suPHP Conversion Problems

To fix/prepare all cPanel accounts for the conversion to suPHP, you would run (This was the default option before version 2.0.0):

/scripts/suphpfix.pl --prep all

To fix/prepare the 'liquidweb' cPanel account for the conversion to suPHP, you would run:

/scripts/suphpfix.pl --prep liquidweb

Restoring States

To restore all saved cPanel accounts permissions/ownerships in WWW, run:

/scripts/suphpfix.pl --restore-state all

To restore just the 'liquidweb' cPanel accounts permissions/ownerships in WWW, run:

/scripts/suphpfix.pl --restore-state liquidweb


Notice: If you want to see what chmods/chowns suphpfix will run before suPHPfix makes any changes, add verify. Example: /scripts/suphpfix.pl --restore-state all verify


Full Usage/Help

>> /scripts/suphpfix.pl --help
-suphpfix 2.0.0
*** Options:
+++ Fix common problems when converting to suPHP
--prep all ==>  
   This will chown all cPanel users files/directories in their public_html's to cPanelUser.cPanelUser. It will also remove group and world write from files/directories. In addition, any php directive in .htaccess such as php_flag will be  commented out  (unless htscanner is present). 
--prep cPanelUser ==> 
   Same as '--prep all' but only applies fixes to the specified cPanel account.
+++ Saving states
--save-state all ==>
   This saves the current permission/ownership settings (for later restores) for all cPanel accounts files/directories under their public_html's.
--save-state cPanelUser ==> 
   Same as '--save-state all' but only for the specified cPanel account.
+++ Restoring states
--restore-state all ==> 
   This restores all saved cPanel accounts permission/ownership settings at the time --save-state all was last ran. It also uncomments any php directives in accounts .htaccess file(s).
--restore-state all verify ==> 
   Same as '--restore-state all' but just outputs proposed chmods/chowns for all accounts without actually changing anything.
--restore-state cPanelUser ==> 
   This restores only the specified cPanel accounts permissions/ownership settings at the time --save-state was last ran for the user. It also uncomments any php directives in the accounts .htaccess file(s).
--restore-state cPanelUser verify ==> 
   Same as '--restore-state cPanelUser' but just outputs proposed chmods/chowns for the user without actually changing anything.
*** General:
* suphpfix uses /root/datastore_suphpfix/ to store JSON data. These JSON files allow suphpfix to store what permissions/ownerships each backed up cPanel user had at the time of the last --save-state. There are two JSON files for each cPanel account (one for files, one for directories). In this directory suphpfix uses backedupUserList.all to store what cPanel users were backed up with --save-state all.


Info: to view the changelog go here SuPHPfix


Known Issues

There are currently no known issues.

Feature Requests/Bug Reports

Please send feature requests and bug reports to ssullivan@liquidweb.com