To work with PHP, we should have a web host and a MySQL
If you have a server that is configured for PHP, you can start by creating a file with extension “.php” and save to web directory. Server will parse it automatically.
You do not need any extra tools.
How to install PHP on localhost:
Download software “WAMP” – for Window, “LAMP” – for Linux and “MAMP” – for Mac OS
First start your Wamp server.
Create a file and save it with extension “.php” into the directory www. Now, you can run directly from any browser with its filename.php.
<?php echo "WELCOME TO SHAREQUERY"; ?>
Save this file into directory: wamp/www/myfirstprogram.php
To Run: – Go to browser and search: http://localhost/myfirstprogram.php
Note:- By default the Apache Server runs on Port – 80. If there is any other port then, you have to run program as:
Suppose 8080 is port.
If you are using Xampp, then please follow this directory-
Suppose your Xampp is installed in C-directory.
C:/xampp/htdocs/your php files
To Run: – Same as mentioned above for WAMP