what is php

What is PHP?

What is PHP? PHP (Hypertext Preprocessor) is a free and open-source server-side scripting language that is widely used for programming websites. It can be said that PHP is a fierce competitor of Microsoft’s ASP, which has taken a large share of the market today. PHP language is combined with HTML and can be used to design website pages.

PHP codes are placed inside HTML codes and make HTML pages dynamic. The difference is that PHP pages are saved with the .php extension.

PHP codes are placed inside <?php and ?>.

<!DOCTYPE html>
<html>
<body>
    <?php echo "Hello World!"; ?>
</body>
</html>

As you can see, PHP codes are placed inside HTML codes. The border between PHP and HTML codes is marked with two symbols <?php and ?>.

The feature of PHP is that it is very easy for beginners and at the same time it has advanced features for professional programmers.

PHP has been used to create systems such as WordPress, and today about 30% of the websites on the Internet using this system.

What are the prerequisites for starting PHP programming?

To start programming with this language, you must first be familiar with the following topics:

Then, to start programming, you need a host that has PHP and MySQL installed on it, or you can install them on your local host. Today, almost all Linux hosts include PHP and MySQL, and in the following, we will tell you how to install PHP on the local host.

What is a PHP file?

PHP files not only contain the codes of this language, but also HTML, CSS, and JavaScript codes.

The PHP file is saved with the .php extension and this extension can be seen in the URL address.

https://honarsystems.ir/index.php

All PHP codes are executed on the server side and the result is sent to the user in the form of HTML codes and displayed to the user.

What can you do with PHP?

With PHP we can do the following tasks:

  • Create dynamic pages
  • Working with files (creating, editing, and deleting files)
  • Work with forms
  • Working with cookies and sessions
  • Communication with databases
  • Determining user access
  • Data encryption

Advantages of PHP

  • It can be used on all platforms (Windows, Linux, Unix, Macintosh, etc.)
  • It is compatible with almost all servers such as Apache, IIS, etc
  • Supports most databases
  • PHP is free to download and use
  • It is easy to learn yet very powerful

PHP Download

As we said above, PHP is a free and open-source language that you can download from its official site.

Download PHP

Installing PHP on localhost

To use PHP, you need to install not only this language but also servers such as Apache and MySQL. There is software such as Wamp and Xampp that these systems are installed together on the local host. In the following, we will discuss how to install and operate each one.

Install WampServer

Download the latest version of Wamp for your operating system by visiting the WampServer website.

After downloading the file, double-click on the EXE file to be ready for installation. A window similar to the image below will open. Click on the OK button to be directed to the next step.

What is PHP

Then the software rules window will be displayed, and by accepting the rules and clicking the Next button, you will go to the next window.

In the next window, you will see information about the WampServer software. Go to the next window by pressing the Next button.

What is PHP

Next, you must select the desired drive to install the program.

In this window, similar to the image below, you can select the components required to install Wamp. Click Next to continue again.

In this window, it asks you for the name of the Start menu. Click on the Next button.

What is PHP

In this window, just click on the Install button to start the installation process.

During installation, it will ask you for the default browser and default editor. Select No for both.

At this point, the WampServer installation is complete.

What is PHP

Install Xampp

Download the latest version of the Xampp program for your operating system by referring to the Xampp website, similar to the image below.

After downloading the file, double-click on the EXE file to be ready for installation. A window similar to the image below will open. Click on the Next button to be directed to the next step.

What is PHP

After clicking on the installation button similar to the image below, you can select the components needed to install Xampp. Click Next to continue again.

Next, you must select the desired drive to install the Xampp program.

Finally, by clicking on the Next option, the installation of Xampp in Windows will begin at this stage as well.

What is PHP

After the installation is finished, if all the steps have been followed correctly, a successful installation message will be displayed to you, similar to the image below. Just click on the Finish button and wait for the Xampp program to run on your computer.

To turn on the host as shown in the picture, click on the Start buttons placed in front of Apache and MySQL and wait for them to turn green.

What is PHP

Online PHP compilers

In addition to localhost and server, you can also run your PHP codes online. There are sites that allow you to do this. We have introduced 2 examples of them below:

Shopping Cart