What is PHP? – Basic PHP Programming Guide

Custom Post Types: How to create custom blog types in WordPress
How to add Twitter Cards in WordPress

In short words, PHP is a programming language used by programmers and developers to build dynamic websites, application integration extensions and expedite the development of a system.

This language is known worldwide and one of the most used by the facility to learn it, handle it as well as being compatible with almost all operating systems that exist, making it the lowest cost. In this article we’ll show you the importance of this acronym, beyond the structure and advantages of this language. Come on?

When it did and how it works

Nowadays, the PHP is one of the most widely used programming languages in the world. the term PHP, which previously meant Personal Home Page and is now known as PHP  Hypertext Preprocessor , was created with only a cluster of codes CGI, an element that makes the physical connection or logical between two systems or servers, described in a C language

The initial idea was to monitor the traffic of personal website creator. The years passed and the creator developed scripts, which increased the resources that his site had.

The success of this language was so great that the creator, Rasmus Lerdof transformed the cluster codes CGI in a programming language .. Thus, the vast majority of websites and applications started to use PHP as a primary language.

PHP versions

In 1997, two programmers have reshaped the codes PHP and released PHP 3, changing the name of Personal Home Page for PHP  Hypertext Preprocessor , as we mentioned above. This version had the first form of guidance object resources.

With this update, developers could implement methods and public códigos.Testes were made and in June of the following year he was released from official way. Two years later, the version of PHP 4 has been released, giving more resources to the language. This version had a problem, the ability to create copies of objects. This is because the language did not work with handlers or pointers. This has been fixed in version PHP 5 . 0 , the most widely used by programmers.

Currently, PHP is version 7.2 . And no, there was not a leap from version 5.0 to 7.2, only the preference of developers for version 5.0 or 5.3 between versions 6.0 and 7.0.

But enough of history, because to understand how to use php to create a project, you need to understand the language it works, or rather, the first steps to program a web system.

Back-end and Front-end – two distinct sectors, but important

There are two stages of work when it comes to creating a website, online design, games, software or applications, are the front and back ends. You know when you access a site or an application on the internet, you are looking at is the page of the interface, in which it was done with the front-end work.

The form of creation that is used by PHP, is the back-end, ie when you want to access any site on the Internet, all data processed for you to get into the desired page are processed by the back-end to send the information and data to the front end, you have programmed the entire page of the user interface.

And PHP is known to use the back end because all use of this sector is facing servers. We use this same site language PHP , as well as other programs. In addition to websites, some programmers also perform back-end for mobile applications, but it depends on the skill of the programmer and the need for the project, because in most cases, this language is not appropriate. Ie, front and back ends are sectors that work in different ways.

What can we do using PHP

What you can do using PHP?

When you want to create a website or a web system, as an e-commerce or CMS, you will come across scripts. They are scripts that provide information that will be analyzed, processed and transformed into shares, for a certain type of language. In this case, the language is PHP .

With it, you can create applications to effect some task that you determine. These applications are compiled within a server, called the server-side , or script on the server side, a traditional term and widely used by programmers when it comes to PHP .

For you can make these scripts work, you will need the following items: a browser, the interpreter PHP and a web server. You can learn how to install this items in the installation guide and configuration of php .

Still speaking in scripts , with PHP you can create a script and use it without the need for a browser. You only need the interpreter. This function is very useful for programmers who want to run the script to create APIs. This function is called script execution via the command line .

You can also create desktop applications. It is not very common, but if you are a programmer who likes challenges, able to use the most advanced services. To do this, you need to use PHP-GTK , an extension of PHP that will help create these applications you.

Tips for PHP applications

Developing a website or a project on the Internet is not easy, there are things you should care enough for everything perfectly occur, such as security. You need to ensure the security of your system and users who visit. Therefore, developers need to be aware and alert to the threats that exist in the world of internet.

     1- different Cookies

The first tip is to avoid the occurrence of session hijacking. Like any attacker has knowledge of the default name used by PHP to save IDS, which is PHPSESSID , to change its name, makes entry or action of any attacker who wants to restrict the application.

     Access 2- HTTP Cookies

IDS are stored in a standard way, as we just show up, however, the property session.cookie_httponly is not standard. Within the PHP , there is a setting where you can access the values of the variables saved in the browser via JavaScript, which brings a risk for your application. It is therefore recommended to be enabled session.cookie_httponly the file php.ini . By doing so, you make it possible to access the information only via HTTP.

This would prevent the famous Cross-site scripting (XSS) , an attack that takes advantage of the vulnerability of a system and JavaScripts codes are injected to steal information from the site that was attacked.

     3- Protect your private folders

This method is not unique to pages that have been programmed with language PHP is a basic defense in the web server configuration, but important. Within the PHP you will find various settings stored in files XML, txt, JSON, ini and many others. And when you access these files by the browser, everything is visible, and if any information or sensitive files, you need to protect.

However, this setting is only for Apache web server, and must be enabled the mod_rewrite so that the file .htaccess to work correctly with the instructions below:

<Files>

order allow, deny

deny from all

</ Files>

 

This will prevent access.

PHP and its advantages

Benefits of using PHP

As mentioned above, PHP runs on most operating systems, this makes maintaining a site that has been programmed in PHP is much easier and cheaper. In addition, spending on servers and implementations are lower than other languages.

The PHP works well on almost all databases like MSSQL, Oracle, DB2, MySQL. That is, it cost less because it does not have the need to migrate all your site’s database in order to migrate to PHP.

The interpreter PHP can also be used by most web servers in various operating systems such as Linux , Windows , Mac and etc. In addition, PHP has the resources to process texts and other tools, with a wide range of extensions, such as XML, PDO, GeoIP . You can check out the entire list of extensions on the official site PHP .

active community

Like PHP is the “market” for over 20 years, a wave of programmers of various levels help each other with ideas and improvements solutions in the script. In addition to helping beginners who are trying to program for the first time using the language PHP . Two very active communities are w3schools and iMasters . There are several tutorials for all types of functions that PHP can perform and it helps beginners who want to start developing a project. You can also access the manual official site PHP .

It’s worth learning how to program in PHP?

There are several other languages to program a website or do certain type of application, however, the PHP is usually rapid and the most cost – effective option. It is widely used for creating systems using database for medium and large companies.

Many developers say that the language is only used for the creation of small and robust e-commerces sites, but with the right knowledge and advanced techniques, you can leave the “comfort zone” and program a system with multiple functionality.

The Facebook, for example, is a huge site that at first was used language PHP to create it. Today the language is still used, but in more specific systems of the site. The WordPress is also a site that uses php in the back end of the site

Other famous sites that also use this language are the WikiPedia, Flickr, Digg and Yahoo. So the story of the php only good for small sites, can be a bit badly told.

How is a language that can be used in countless ways, the job openings for programmers and technicians to create sites and technology companies are large agencies. According to a survey by RedMonk in 2016, the most sought-by programmers have expertise in php appears in 3rd position . That is, if you have advanced knowledge in PHP , job openings will not miss.

basic guide to programming in PHP concuído

Conclusion

He gave to see that language PHP is too important to the web, is not it? Besides being a language, say, “wild card” because it can be used to create small sites, medium and large, it offers you numerous job opportunities. We hope you enjoyed this introduction to PHP and the tips that we present. Any questions just leave a comment.