FatCow Plan for $3.67/mo. only HostPapa 100% Green Energy Web Hosting
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Single php.ini in Shared Enviroment
06-22-2012, 07:21 AM
Post: #1
Using Single php.ini in Shared Enviroment
If you have a Dedicated Server or VPS and use it to sell shared hosting then this article is for you. Today I am going to explain how you can force your users to use same php.ini under suPHP by disallowing .htaccess override. Limiting php.ini use will add security to your server and will disallow users to use custom php.ini file by overriding default php settings set by server administrator (root).

How to make it work:

Its very simple to enable this function in server using suPHP. Just by enabling phprc_paths in /opt/suphp/etc/suphp.conf will do the work for you. See the steps below:

Code:
vi /opt/suphp/etc/suphp.conf

Find the code below and press I to insert text.

Quote:[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
;application/x-httpd-php=/usr/local/lib/
;application/x-httpd-php4=/usr/local/php4/lib/
;application/x-httpd-php5=/usr/local/lib/

Remove ( ; ) from the last three lines ie.

Quote:application/x-httpd-php=/usr/local/lib/
application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/

Now press ESCAPE button and enter :wq to save the file.

Restart Apache

Code:
/sbin/service httpd restart

Now Users wont be able to override your default php.ini file.

Article Source: Harden php.ini Security

Cpanel Hosting | Do not post more than 1 link in your signature!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)