• Contact Us
  • copyright
  • About Us
  • Privacy Policy
  • Devops
  • Linux
Globedrill

PHP Warning: show_source() has been disabled for security reasons

Linux/10 Jun, 20/591/0
Linux

PHP Warning: show_source() has been disabled for security reasons

 

I got the below error on my Linux server. Error shows PHP show_source function is disabled on the Linux server. show_source PHP function is used to output the code of the PHP file in the web browser.

Some of the web hosting providers disable this PHP function server-wide for security reasons.

 

show_source has been disabled for security reasons

show_source has been disabled for security reasons


 

Follow the below steps to fix the error by enabling show_source function.

1. Open a new terminal and log into your server via SSH as ‘root’ user

2. Check whether show_source is added in PHP disable functions

Run the below command to check whether show_source function is added in PHP disable_functions.
 

# grep disable_functions /etc/php.ini
disable_functions = show_source

 
On my server php configuration file is in path /etc/php.ini. The path might be different on your server. Run the command “php --ini” to find the path of the php.ini file.

The above command output shows show_source PHP function is added in disable_functions.

3. Remove show_source from disable_functions

open php.ini file using your favorite editor.
 

vi /etc/php.ini

 
Go to disable_functions line and remove show_source.

Save the PHP configuration file and exit the editor.

This will enable the show_source PHP function.

Note : This function might be disabled to harden the PHP installation. You must enable this function only if it is required. Functions added in PHP disable_functions are exploitable dangerous PHP functions.

4. Restart the web server

You must restart the web server for changes to take effect.
 

# service httpd restart

 
5. Create a phpinfo file to verify

Create a phpinfo file under your website to check whether the show_source function is removed from the disable_functions line.
 

phpinfo show_source is disabled

phpinfo show_source is disabled


 
In the above phpinfo, you can see that show_source function is disabled.
 

Leave a Reply Cancel reply

.

About Us

Globedrill.com is a website that publishes articles related to Linux and Devops. Globedrill was started on April 2016.

Contact Us

Email : globedrill.c@gmail.com

Globedrill

Copyright © 2016 Globedrill. All Rights Reserved. The content in this website is copyrighted to Globedrill.com and may not be republished either online or offline.

  • About Us
  • Privacy Policy
  • Contact Us
  • copyright