PHP (Hypertext Pre Processor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. The goal of the language is to allow web developers to write dynamically generated pages quickly. It is powerful enough to be at the core of the biggest blogging system on the web (WordPress , 25% of Web is powered by WordPress now)!
Requirement to Learn PHP :
Before you continue you should have a basic understanding of the following:
- HTML
- CSS
- JavaScript
What is a PHP File?
- PHP files can contain text, HTML, CSS, JavaScript, and PHP code
- PHP code are executed on the server, and the result is returned to the browser as plain HTML
- PHP files have extension “.php”
Environment Setup to Run PHP
- install a web server (Apache, NGINX, IIS)
- install PHP
- install a database, such as MySQL(or SQLite,Postgres,Oracle,Access,Firebird …) and phpmyadmin
Better Install Cross-Platform Xampp(run on Linux,mac and Windows) or install wampp for windows, mamp for Mac or lampp for Linux.
As you know that if you work with WAMP Server then .php file will save in your own project directory in root like WWW . If you work with XAMPP Server then .php file will save in your project directory in htdocs. Now we will create a program which will produce some output on browser. So copy and save in a file with .php extension and Run it.
Create a File welcome.php in root folder (We are using xampp means in htdocs folder) with code given below.
<?php
echo “WELCOME”;
echo ”PHP PROGRAM”;
?>
Now Access it by http://localhost/welcome.php (After running Xampp)
Output:
WELCOME PHP PROGRAM
[…] PHP Introduction and Environment Setup […]
If you are macOS user, ServBay.dev is a good tool, especially for the beginners. It handles all PHP, MariaDB, PostgreSQL versions, plus redis and memcached. Run multiple PHP instances simultaneously and switch easily. This tool has made my PHP dev simpler. Worth a shot!
Using Linux ….