What is PHP?
PHP is a high-level language that runs on the server.
What is PHP?
PHP is a high-level language that runs on the server.
What does it mean that it runs on the server?
A server language is one that runs on the server where the pages are hosted, unlike other languages that are executed in the browser itself.
What are the advantages of being a server language?
The main advantage is that, when executing the code in the server, all our pages will be able to be seen in any server, regardless of the browser you have. On the other hand, the big problem that the code is executed in the browser is that many browsers are not able to understand the whole code, which would present errors when displaying the result on the page.
What other advantages does the PHP language have?
Mainly that it is a free programming language and, therefore, everyone can use it without any price, compared to other languages whose software is necessary for its use.
The following figure shows a graph of the process that is carried out when visiting a page in PHP.
PHP is an open-source scripting language, for all purposes and widely used. Originally, it was designed to be used in the development of websites. In fact, PHP started his life as the Personal Home Page, tool for personal pages, developed by Ramus Lerdorf to help users with Web page tasks. PHP proved so useful and popular, that it quickly grew into a full-fledged language, with all the features of today; acquired the name of PHP Hypertext Preprocessor to represent its expanded capabilities: Process Web pages before displaying them.
The popularity of PHP continues to grow rapidly due to its many advantages:
- It's fast: In websites, and because it's embedded in HTML code, the time to process and load a Web page is short
- It's free: PHP is proof that free lunches do exist, and you can receive more than you expect for your money
- It's easy to use: The syntax is simple and easy to understand and use, even for non-programmers. For use on websites, PHP code is designed to be easily included in an HTML file
- It is versatile: PHP runs on a wide variety of operating systems: Windows, Linux, Mac OS and most of the UNIX varieties
- Technical support is widely available: You can subscribe to one of the several electronic discussion lists offered on the PHP website (www.php.net), which cover topics such as PHP in general, PHP on Windows or databases. data and PHP. In addition, there is a web interface to the discussion lists at news.php.net, where you can browse or search between messages
- It's safe: As long as your scripts are designed correctly, the user will not see the PHP code
- Can be customized: The open source license allows programmers to modify PHP software and fix or modify features necessary to adapt to their own environments. PHP provides significant control over the environment, which reduces the likelihood of failure
Consider the various uses of PHP
PHP is a general-purpose language that can be used to write scripts for general purposes. Scripts are computer files that contain instructions in the PHP language, which tell the computer to do things, such as showing Hello on the screen or storing specific data in a database. Most scripts contain a series of instructions that can perform tasks from designing web pages to navigating a file system. As PHP started its life on the Web, it has many features suitable for use in scripts that develop dynamic web pages.
Currently you will see PHP used more frequently in web pages, but its use for other purposes is growing.
PHP is very popular for websites. According to the PHP website (www.php.net/usage.php), more than 11 million domains use PHP. Yahoo!, probably the most visited website in the world recently decided to change its proprietary language to PHP.
Using PHP for web applications
In the beginning the web pages were static: they only presented documents. Users visited websites to read information. The documents were linked so that users could easily find the information they were looking for, but the web pages did not change. Every user who came to the website saw exactly the same.
Soon, web developers wanted to do more. They wanted to interact with visitors, collect information from users and provide web pages that were tailored to each individual. Several languages have been developed that can be used to create dynamic websites. PHP is one of the most successful languages; It evolved rapidly to become more useful every day, which quickly increased its popularity.
PHP is a server-side scripting language, which means that the scripts run on the server side (the computer where the website is located). It's different from JavaScript, another popular language for dynamic sites. JavaScript is executed by the browser, on the user's PC. Therefore, it is a client-side language.
As the script runs on the server, PHP can dynamically create the HTML code that the web page generates, which allows individual users to view custom web pages. Visitors to the website see the output of the scripts, but they are not the scripts themselves.
PHP has many features designed specifically for use on websites, including the following:
- Interact with HTML forms: PHP can display an HTML form and process the information that the user types
- It communicates with database: PHP can interact with databases to store user information or retrieve information that is taught to the user
- Generates secure web pages: PHP allows the developer to create secure web pages that force users to enter a valid username and password before viewing the content of web pages
PHP features make these and many other tasks on web pages easy.
PHP only works on the server side, which means it cannot interact directly with the user's PC. That means that PHP cannot initiate actions based on the user's PC status, such as mouse actions or the size of the screen. That's why PHP cannot produce some popular effects on its own, like navigation menus that unfold or change color. On the other hand, JavaScript, an example of scripting on the client side, cannot access the server, which limits its possibilities. For example, JavaScript cannot be used to store data on the server or extract it from the server. But wait! It is not necessary to choose between them. You can use JavaScript and PHP together to produce web pages that none of them could produce alone.
Using PHP in applications with databases
The ability of PHP to interact with databases is particularly robust. PHP supports virtually any database that you have heard about and know about. PHP handles the connection and communication between the database, so you do not need to know the technical details of how to connect to the database or how to exchange messages with it. Just tell PHP the name of the database and where it is, and PHP takes care of the details. It connects to the database, for its instructions to the database, and returns the response from the database.
The most important databases that PHP currently supports include the following:
- dBASE
- Informmix
- Ingres
- Microsoft SQL Server
- mSQL
- MySQL
- Oracle
- PostgreSQL
- Sybase
PHP supports other databases as well, such as filePro, FrontBase and InterBase. In addition, PHP supports ODBC (Open Database Connectivity), a standard that allows you to communicate with many more databases, such as Access and IBM DB2.
PHP works well with a website driven by a database. The PHP script on the website can store data and extract data from any database that is supported. PHP also interacts with databases supported outside of a web environment. The use of databases is one of the best features of PHP.
Use PHP with a file system
PHP can interact with its file systems: the directories and files that are on the hard disk or on another PC accessible through the network. PHP can write to a file in its file system. You can also create directories, copy files, rename them, delete them, change their attributes and carry out many other file system tasks. PHP allows you to perform almost any task related to your file system.
Many websites need to interact directly with the file system. For example, a web application may store temporary information in a file instead of a database, or it may have to read information from a file.
Administrative and system maintenance scripts frequently need to interact with the file system. For example, you may want to use a PHP script to back up files, clear directories or process text files and reformat their content. PHP can fulfill these tasks quite well.
Use PHP for system commands
PHP can interact with your operating system to perform any task that the operating system can perform. You can execute an operating system command and receive the output. For example, you can execute a dir or ls command (to list the files in the directory) from PHP and receive the list of file names corresponding to the dir/ls command.
ChatGPT Free
Ask questions on any topic
CITE ARTICLE
For homework, research, thesis, books, magazines, blogs or academic articles
APA Format Reference:
Delgado, Hugo. (2019).
What is PHP?.
Retrieved Dec 13, 2024, from
https://disenowebakus.net/en/what-is-php