DEV Community

loading...
Cover image for PHP Getting Started

PHP Getting Started

danielmabadeje profile image Daniel Mabadeje Updated on ・3 min read

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:

  1. PHP can generate dynamic page content.
  2. It can create, open, read, write, delete, and close files on the server.
  3. It can collect form data.
  4. This language also, can send and receive cookies.
  5. PHP can add, delete, modify data in your database, in other words, it can manipulate the database.
  6. As a server-side language, it can be used to control user-access.
  7. It can encrypt data.
  8. PHP files can contain HTML,CSS and Javascript.

so Why PHP?

  1. PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  2. PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  3. PHP supports a wide range of databases
  4. PHP is free. Download it from the official PHP resource: www.php.net
  5. PHP is easy to learn
  6. It runs efficiently on the server side

Installation

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.

Getting started with PHP.

To start using PHP, you can:

  1. Find a web host with PHP and MySQL support.
  2. 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:

  1. install a web server.
  2. install PHP.
  3. 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!";
?>
Enter fullscreen mode Exit fullscreen mode

And Voila!! you have setup PHP on your PC.

MATERIALS

In order to get full documentation on PHP

check www.php.net

As other languages have their frameworks, so does PHP

Frameworks like..

  1. Laravel
  2. CodeIgniter
  3. Symphony
  4. CakePHP
  5. Zend
  6. Yii
  7. Fuel PHP
  8. Phalcon

and many others

for tutorials check
https://www.w3schools.com/php/default.asp
https://www.tutorialspoint.com/php/php_introduction.htm
and others..

for Online Code editors or environments you could check
https://phpsandbox.io/

feel free to check me out on Github:https://github.com/DanielMabadeje

Discussion (0)

Forem Open with the Forem app