Basic Overview of PHP | How PHP works
Definition of PHP
PHP stands for “Hypertext Preprocessor”. It is an open-source scripting language and a powerful tool. It is widely used for creating dynamic websites, interactive page content.
How it is used| Uses of PHP
- PHP is mostly used language for websites all over the world nowadays. Most of the websites are made with WordPress and WordPress has a large number of plugins and these plugins are made in PHP.
- World’s biggest social media network Facebook which is run by PHP.
- PHP is used to create application software like stock management, inventory management, billing software, and custom application, etc.
How PHP works
Benefits/ Advantages of PHP
- PHP is used to control user access authorization.
- With PHP we can display images, PDF files, and even Flash movies.
- We can run PHP on various platforms like Windows, Linux, Unix, etc.
- PHP is compatible with servers like Apache, IIS, etc.
- PHP is supported by a wide range of databases.
Requirements for running PHP programs/scripts/codes
- First of all, install any local server like WAMP or XAMP, etc.
- Install any editor like notepad++ or code-lobster or sublime text etc. but in my case, I use code-lobster mostly due to its reliable features and I recommend you to use code-lobster if you want.
How to run PHP programs/scripts in local server
After completing the installation process, click on the WAMP server and wait until it turns into a green icon. To run the PHP scripts we have to start the WAMP server that provides MySQL database access, we don’t need any extra database to be installed.
Type in the address bar of your browser “localhost” then you can see a list of Index which contains the folder names of your PHP scripts or projects. Again type “localhost/phpmyadmin” in the address bar then a screen will appear with username and password.
Type the username with “root” and leave the password field blank and press ENTER. Now you are in PhpMyadmin where you can create a database and the corresponding tables for the PHP projects.
Create a folder for your project in the place you have installed WAMP server. I suggest you install the WAMP server in D or E drive. Go to the ‘www’ folder inside the WAMP folder and then keep all your PHP projects or folder of the projects here.
To run the scripts or projects you did just go to the address bar and type “localhost/name of the PHP script file with .php extension as “localhost/helo.php” then you can see the output of the script which is executed by the server and returned back in the browser as plain HTML.