SuPHP and LSPHP directives for php.ini on shared servers

SuPHP (Single user PHP) is a php handler which executes PHP scripts with the permissions of their owners. LSPHP  is a combination of mod_lsapi+PHP. Depending on the server your account is hosted on either suPHP or LSPHP is installed.

For the settings from the chosen php.ini file to work, specific directive should be added to your .htaccess file.

For suPHP, you should add the following configuration directive to the .htaccess file:

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USER/public_html
</IfModule>

For LSPHP, you should add the following configuration directive to the .htaccess file:

lsapi_phpini /home/USER/public_html/php.ini 

NOTE: Make sure you replace USER with your cPanel username.

This option specifies which path to pass on to the PHP-interpreter and which folder to execute php.ini from.

Follow the instructions below to proceed with the setup:

for cPanel paper_lantern theme
for cPanel x3 theme

for cPanel paper_lantern theme:

1. To add these lines to .htaccess file, go to cPanel > Files section > File Manager menu:

2. Navigate to public_html directory:

3. Click on Settings in the right top corner and enable Show Hidden Files (dotfiles) in the pop-up window, that will allow you to see .htaccess file:

4. If there is no .htaccess file in the document root, you need to create it using File option:

5. Right-click on .htaccess file > Edit or use Edit option located in the toolbar:

6. Add the lines provided below into .htaccess file and Save Changes.
For suPHP:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USER/public_html
</IfModule>

For LSPHP: 
lsapi_phpini /home/USER/public_html/php.ini 

If you have done it right, the designed php.ini will take immediate effect.

7. If you need to load php.ini for/from subdirectory, make sure you edit ConfigPath accordingly:

for cPanel x3 theme:

1. To add these lines to the .htaccess file, go to cPanel >  the Files section > the File Manager menu:

2. Choose the Web root and Show Hidden Files options and hit Go:

3. Right-click on .htaccess file > Edit:

4. Add the lines provided below the existing rules and Save Changes.

For suPHP:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USER/public_html
</IfModule>

For LSPHP: 
lsapi_phpini /home/USER/public_html/php.ini 

If you have done it right, the designed php.ini will take immediate effect:

5. In case there is no .htaccess file in the document root, you need to create one via the New File option and edit it following the guidelines above:

6. If you need to load php.ini for/from subdirectory, make sure you edit ConfigPath accordingly:

That’s it!

SuPHP و LSPHP برای php.ini

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

17 − 8 =