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 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.
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.
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”.