PHP the acronym of Hypertext Preprocessor, is a widely-used open source general-purpose scripting language used for web development. It was created by Rasmus Lerdorf in 1994. The difference between PHP and other client-side scripting languages like JavaScript is that PHP code is executed on the server and generate HTML which is then sent to the client. Php is normally installed as an executable program on the system.

The preferred locations of PHP in Unix system:

If PHP is installed on your system and doesn’t know its location, you can easily find it using some quick techniques.

If you have root access to your system and have a little idea about the command prompt, a single line of code is enough to display the PHP location. You can use PUTTY software.PuTTY is a free SSH and telnet client for Windows and Unix platforms, along with an xterm terminal emulator. Open Putty program enter your IP address or Hostname, enter the port number (22), select connection type, select SSH. Then click open, the command prompt will appears. In ‘login as’ type ‘root’, when asking for your password, enter the root password. Hit enter key, now type,

which php 

The location of the PHP installation is displayed. Now type,

whereis php

PHP location with php.ini file and other details are displayed. You can check the above screenshot to know how to use the code in the command prompt.
If you are installed on your Windows computer for testing purpose. The preferred location is: C:\program files\php

There is one more method to view your PHP installation path and other details. This is useful if you don’t have any access to your server. If you are using a shared hosting environment you can follow this method. But you need to create a webpage with a simple PHP script and place it in your server. In a normal text editor like notepad create a file like phpinfo.php or some other with the following code:

<?php phpinfo(); ?>

Save the file as .php or as a .html file (eg: phpinfo.php). Upload this file to your websites main directory like the public_html directory or some other directory. Open your favorite browser, in the address bar type, (in this case, A detailed page with PHP version installed, the location of the php.ini file and other details related with your PHP installation will also be displayed. You can easily get some readymade
‘phpinfo.php’ file from different sites, but before using it, just open it in notepad or some other apps to ensure the code doesn’t contain any other malicious or tracking code.


Speed up your life, work faster, live better & do things smarter. Free guides & tips for achieving anything you want in your life. Our guides, tips, and tricks helps you to use the internet, software, gadgets, and apps even better. All information at Your Fingertips.

You May Like