So you want to start PHP?
Welcome, because in this article we will be looking at getting started with PHP
First of all what is PHP?
PHP is an acronym for "PHP: Hypertext Preprocessor". PHP is a widely-used, open source scripting language. PHP scripts are executed on the server. That means PHP is a server-side language i.e scripts executed on the server mostly backend.
Before we go into installation, lets see what PHP can do. PHP can do this and more:
- PHP can generate dynamic page content.
- It can create, open, read, write, delete, and close files on the server.
- It can collect form data.
- This language also, can send and receive cookies.
- PHP can add, delete, modify data in your database, in other words, it can manipulate the database.
- As a server-side language, it can be used to control user-access.
- It can encrypt data.
so Why PHP?
- PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
- PHP is compatible with almost all servers used today (Apache, IIS, etc.)
- PHP supports a wide range of databases
- PHP is free. Download it from the official PHP resource: www.php.net
- PHP is easy to learn
- It runs efficiently on the server side
At the time this article was written the version of PHP was version php 7.
At the moment PHP is much faster than previous PHP versions, it supports new operators and it also has an improved error handling technique.
To start using PHP, you can:
- Find a web host with PHP and MySQL support.
- Install a web server on your own PC, and then install PHP and MySQL. Most web hosts used are Laragon, Xampp, Wamp etc.
If your server has activated support for PHP you do not need to do anything.
Just create some .php files, place them in your web directory, and the server will automatically parse them for you.
You do not need to compile anything or install any extra tools.
Because PHP is free, most web hosts (locally or production) like the ones listed above offer PHP support.
However, if your server does not support PHP, you will need to:
- install a web server.
- install PHP.
- install a database, such as MySQL.
After doing all this, create a file with .php extension in the folder provided for you to put your projects. E.g In Laragon, every project you want create is in www folder. while in xampp, it is in the htdocs folder.
now lets write our first line of code in the newly created file..
Please note that PHP codes start with <?php and end with ?>
so let's try..
<?php $txt = "PHP"; echo "I love $txt!"; ?>
And Voila!! you have setup PHP on your PC.
In order to get full documentation on PHP
As other languages have their frameworks, so does PHP
and many others
for tutorials check
for Online Code editors or environments you could check
feel free to check me out on Github:https://github.com/DanielMabadeje