Since long before the internet was invented, there are ways to create rules and conditions on the computer for a particular script to unfold. This set of rules and conditions is called the algorithm. In the world of computers, for an algorithm to be executed, it must be written in a programming language.
A programming language is like a language. Just as there are several languages and they can all transmit the same message, there are lots of programming languages and they can all contain the same algorithm. A computer can interpret several programming languages, just as some people can speak different languages. The prerequisite for this is that the program that interprets the programming language is installed on the computer.
In this article, we will talk about one of the most commonly used programming languages on the internet today. Keep reading and find out what PHP is.
PHP programming language
Because it is a language that runs only on the hosting server, the end user cannot “see” the PHP script. Only developers and people with server access will be able to view the program source code written in PHP. Because of this feature, PHP is known as a back-end language.
The popularity of PHP is due in part to the fact that it can be merged with HTML, which is the markup language used on any web page. HTML is not a programming language and its content is static. PHP allows you to create content dynamically, through scripts and schedules on the server.
PHP also has integration with a huge variety of databases, which makes this language quite powerful. Currently, PHP is used on more than 80% of websites across the internet, according to the W3 Techs website.
What you can do with PHP
The fact that PHP can be mixed with HTML makes the language very accessible for beginners in programming, unlike languages like C or Java, which require complex maneuvers to generate an HTML page. Thus, PHP offers a myriad of possibilities, from the creation of simple sites to much more complex systems, such as virtual stores and online management platforms.
Let’s look at some of the types of web applications that can be created with PHP. You’ll even see that many of the systems we use in our day-to-day lives are written in PHP.
We call dynamic website to any website whose pages are controlled by an application present on the server. Thus, parameters and scripts defined in the site source code determine how pages will be assembled before they are sent to the user’s browser. With PHP it is possible to build several types of dynamic websites. They may or may not be integrated into a database.
Many content managers were built with PHP, including some quite popular. We can include WordPress, Joomla, and Drupal in this list. In the universe of eCommerce systems and virtual stores, we can mention Magento, Open Cart, and PrestaShop. All of them are created with PHP. This list is much larger, we are just citing a few examples.
You can build almost any type of system using PHP. Do you need an intranet system with login and password for your company employees? PHP can solve. Need a help desk system to serve your customers? A distance learning system? PHP can also do this. There is also a free and open source distance education system written with PHP. We are talking about Moodle.
As we have seen, innumerable types of system can be constructed with this language. And not necessarily they need to be published on the internet. It is possible to run PHP on a local server, available only to users connected to an internal network.
Although it was not created for this, it is possible to use PHP to write programs installed on personal computers. For this, there is a library, called PHP-GTK. If you know PHP well and are comfortable with the language, then this library can be a great solution to build an installed program.
More information about this can be found at the project website, available at gtk.php.net.
PHP scripts with command line
For programmers on call, it is also possible to fire PHP scripts directly from the terminal, using the command line. In this mode, it is not necessary to have a webserver, such as Apache or Microsoft IIS. Only the PHP interpreter will be required for you to run shell scripts with the language.
More information about PHP CLI can be seen on the project website (php-cli.com).
Great sites created with PHP
Great websites were built with language. Although not everyone uses PHP in the backend currently, we can cite as an example Facebook and YouTube as platforms originally written in PHP.
The Wikipedia, one of the world’s largest repositories of information, has also been created (e is maintained to this day) with PHP. The system’s source code is open and is available for download on the project’s website, MediaWiki.
In addition to those cited, many other sites were written with this programming language. Unfortunately, because it is a server language, it is not possible to identify whether or not a particular site has PHP in its code just by visiting the page. In this case, it is necessary to rely on the authors’ statement on the language used.
As we said earlier, PHP needs an interpreter to work. It must be installed on the server where you want to run the script. The interpreter is the program responsible for transforming a code written with PHP into its final format, which would be HTML and other files that make up a website. The PHP interpreter is constantly evolving. From time to time, a new version of the interpreter is released. When we say “PHP version”, we are referring, in fact, to the interpreter version of PHP.
PHP has been introduced in versions 1, 2, 3, 4 and 5 since its launch in 1995. The variations of version 5 (5.2, 5.4, 5.5 and 5.6) were the most significant and most used throughout the existence of the language. There was a community effort to release version 6 of PHP, which would support the Unicode standard, but there was no consensus on this and the project was not materialized. Version 6 has never been released.
In 2015, 11 years after the release of version 5, version 7 was released, bringing numerous improvements, including a considerable performance gain. Version 7 was quickly adopted by developers around the world. This is the recommended version for any new application written with the language.
Web Hosting and PHP
The PHP can be installed on any operating system, including Linux, Mac, and Windows. This versatility means that virtually any hosting company offers web hosting compatible with sites and applications are written in PHP.
When researching about web hosting services, you will find a very large offer of Linux and Windows servers. Although Apple owns a web server service, it is not as popular as the two mentioned above.
Thus, it is possible to host a PHP site in almost any company that offers services of this nature. Preferably, however, Linux is indicated as an ideal platform for sites in this language. This is because PHP is a language native to this operating system and the runtime will be slightly shorter on Linux web hosting servers. Choose a Windows hosting server only if you also want to host, in the same environment, a native application of this operating system, such as ASP.NET.
Where to learn PHP for free
There is plenty of free stuff on the internet for those who wish to take their first steps with language. We have separated some links that can be useful for beginners as well as for other language programmers who want to know more about what PHP is and how to start programming.
PHP Manual – The official language repository, contains the PHP documentation in several languages.
W3 Schools – The world’s largest web development site, with courses in several languages, all free.
If you’ve come this far, you’ve learned what PHP is, that versatile and popular programming language. You also saw what kinds of sites and applications can be made with the language and what to look for to host websites and systems in PHP.