Advantages of PHP over other Languages
MySQL is distributed under the terms of the GNU General License (GPL, GNU Public License).
Previously, for long-term storage of information, we worked with files: we put a certain number of lines in them, and then extracted them for further work. The problem of long-term storage of information is very common in Web application programming: counting visitors in a counter, storing messages in a forum, remotely managing the content of information on a site, etc.
Meanwhile, professional methods of working with files are very time-consuming: you need to take care of putting information into them, sorting it, extracting it, while not forgetting that all these actions will take place on the server of the hosting provider, where it is very likely one of the Unix variants – therefore, you also need to take care of file permissions and their location. At the same time, the amount of code increases significantly, and it is very easy to make a mistake in the program.
All these problems are solved by using a database. Databases themselves take care of the security of information and its sorting and allow you to extract and place information with a single line. The database code is much more compact and easier to debug. In addition, we should not forget about the speed – the selection of information from the database is much faster than from files.
A PHP application that uses a database to store information (MySql in particular) is always faster than an application built on files. The fact is that databases are written in C ++, and writing a program in PHP that would work with a hard disk more efficiently than a database is an unsolvable task by definition, since PHP programs, in principle, work slower than C ++ programs, since PHP is an interpreter and C++ is a compiler.
Thus, the main advantage of the PHP programs can be executed in two ways: as a scripted application by a Web server, and as a console program. Since our task is to program web applications, we will mainly consider the first method.
The fact is that PHP is usually used purely for programming applications related to the Internet. However, PHP can still be used as a command-line interpreter, mostly on *nix systems. The latter is possible using CORBA and COM interfaces, as well as using the PHP-GTK extension.
With this use of PHP, it is possible to solve the following tasks:
creating interactive command-line applications;
creation of cross-platform GUI applications using the PHP-GTK library;
automation of some tasks under Windows and Linux.
MySQL is one of the most popular and most widespread DBMS (database management system) on the internet. It isn’t t designed to work with large quantities of information, but its use is ideal for Internet sites, both small and large enough.
MySQL is distinguished by good speed, reliability, and flexibility. Working with it, as a rule, does not cause great difficulties. MySQL server support is automatically included in the PHP distribution.
An important factor is its free database is that it takes care of all the hard disk work and does it very efficiently.