How to enable PHP functions on VPS Server?

0
926
Php-function-VPS

PHP:

PHP language or Hypertext Preprocessor is a powerful server-side programming language for making dynamic and interactive webpages. It is very flexible and has a lot of innovative features providing to create a website easily. The PHP code is very simple and can be embedded into HTML code and support all major operating systems like Linux, Windows, Unix, Mac OS. PHP support major all web server like Apache, Litespeed, Microsoft IIS.

PHP Functions:

PHP functions are similar to other programming languages. A function can be defined as a piece of code which collects one more input in the form of parameter and does some processing and returns a value. There are thousands of built-in functions in PHP. It can define functions such as Conditional Function, Function within Function, and Recursive Function. PHP gives an option to create our own functions also. There are a few advantages of using PHP functions like code reusability, easy to understand and less code.

Sometimes developers need to enable some PHP functions to run the code like fopen() and fread() etc. The PHP functions are enabled by default in the server. But some PHP functions can be used for malicious purposes. So, it will be restricted in the servers for maintaining the server security.

Few hosting companies restrict some PHP functions for security reasons in shared hosting. If required the client has to buy a dedicated server or VPS server for enabling the specific functions on the server end. The below PHP functions are restricted in shared hosting customers in the server side for some security purpose.

1. show_source
2. system
3. shell_exec
4. passthru
5. exec
6. popen
7. proc_open

The above functions are disabled by default for the shared hosting customers. Here, we have listed only a few functions but there are nearly more than 50 PHP functions which can cause vulnerability. If a hacker hi-jacked your PHP function, then all over-coding functionalities will be under the hacker control. If we enable these functions in the server end, it might affect the website security system. Likewise, you can disable some PHP functions in the server end to enhance the security of the servers.

Steps to Enable PHP Functions:

If a user tries to access a disabled PHP function, then it might show an error message as

[12-June-2019 10:16:51 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /home/username/public_html/file.php on line 7

Then the user needs to enable the phpinfo() in the server end, to resolve this type of error. The following steps will help to check whether a PHP function is enabled or disabled in the server. This facility is only available for VPS server and dedicated server customers. If a function is disabled, then it can be enabled easily by logging in as a root user in the WHM panel.

Step 1: Login into WHM with a valid username and password.


Step 2: Navigate to the Software section and select MultiPHP INI Editor menu. This option is available for root users only.


Step 3: Click the Editor Mode and select the required PHP version from the drop-down box to enable the function. Now the php.ini file will be displayed.

Step 4: Click Control+F and type the keyword as disable_functions and you can find the line. In this line, the disabled PHP functions in the server will be displayed in it.


Step 5: Remove the PHP functions you want to enable and click Save button. Now, the particular PHP function will be enabled in the server.

 

 

 

 

 

 

 

Likewise, to enable the same function in other PHP versions also repeat the steps from 3 to 5. Similarly, we can disable some PHP functions by adding the function name in the line disable_functions in the php.ini file for various PHP versions.

We hope that this article will be helpful to enable PHP functions in the VPS server.  For more information, like us on social media such as Facebook and Twitter. For video tutorials, subscribe to our YouTube channel “ServerCake India”.

LEAVE A REPLY

Please enter your comment!
Please enter your name here