Skip to main content

Now About PHP Info

Have you ever heard about phpinfo(). Yes, this function is used to know about configuration details of PHP installed in our machine. Such detailed information returned by this phpinfo() includes platform information, PHP and server environment, HTTP header information, PHP core details like version and directives status, License information and etc.
phpinfo() function has an optional argument. If this function is called with no argument, then will display all information. We can check it by executing the following code.
<?php
phpinfo();
?>









We can also request specific details to be displayed to the browser by passing available constants to this function. Following list shows such available options.
  • INFO_GENERAL – This will return information about the platform, compiler, architecture, API and etc.
  • INFO_CREDITS – This option provides a hyperlink which shows details about authors, documentation, QA and infrastructure team.
  • INFO_CONFIGURATION – Displays PHP core configuration details.
  • INFO_MODULES – shows all available platform modules with their directive, environment variables.
  • INFO_ENVIRONMENT – will list all environment variables like APPDATA, HOMEPATH and etc.
  • INFO_VARIABLES – Shows an array of predefined global variables.
  • INFO_LICENSE – This shows access rights statement based on PHP license.
  • INFO_ALL – Displays all information.
Note: php_info() and php_info(INFO_ALL) both provide same effect on browser.

Use of phpinfo()

This function is used to check if required support is available with the server or not. For example, in PHP, we can work with the image, if there is GD support.
If we cannot use the image related functions in a PHP script we can check for the availability of GD support using phpinfo() 

Comments

Popular posts from this blog

PHP Image Upload with Size Type Dimension Validation

File upload feature requires basic validations to  make clean and hygienic  the user input. There is a huge chance of exploiting a file upload option with malicious intent. Improper implementation of a file upload input increases security vulnerability. We need to validate the uploaded files before saving them on the server to reduce the vulnerability. I have created a HTML form and provided an option to upload files. When the form is submitted, the file binaries are sent to the PHP and validated in the server side. I have checked if the uploaded file is an image and I have specified the allowed image extension, size and dimension based on which the validation is taking place. After all these validations have passed, the image file is saved in the target location as specified. The server-side image file validation takes place in the following aspects. If the file is not empty. If the file extension is one of .jpg, .png, .jpeg. If the file size is le...

Introduction to MySQL Stored Procedures

A stored procedure is a segment of declarative SQL statements stored inside the database catalog. A stored procedure can be invoked by triggers, other stored procedures, and applications such as Java, Python, PHP. In a simple language its classes for the sql and we can use this for long term goal A stored procedure that calls itself is known as a recursive stored procedure. Most database management systems support recursive stored procedures. However, MySQL does not support it very well. You should check your version of MySQL database before implementing recursive stored procedures in MySQL. Stored Procedures in MySQL MySQL is known as the most popular open source RDBMS which is widely used by both community and enterprise. However, during the first decade of its existence, it did not support stored procedures, stored functions, triggers, and events. Since MySQL version 5.0, those features were added to the MySQL database engine to mak...

Foreach Loop in PHP

In PHP,  foreach  statement is used to iterate over a collection of data, like  PHP arrays . As per the name of this construct, it will keep on continue with the loop to traverse given input array for each of its element, without any condition. We have slightly touched about how this is working in PHP while seeing about  PHP loops . In this article, let us see about  foreach  statement with more details. Unlike other PHP loop statements,  while ,  do..while  and  for , this PHP loop statement  foreach  contains no counters, conditions and no need of increments or decrements, explicitly. Rather, it will iterate with each element and will be useful, where all the elements of the array to be traversed unconditionally. foreach  Usage in PHP Script We can use  foreach  statement in a PHP program with two various syntaxes differed based on the iteration behavior for getting array elements in the following t...