Because "PHP and MYSQL" [closed]

-2

I started learning PHP very little time and I have researched a lot on the subject. I have a question that may seem kind of obvious and "silly" to most of you. My question is, because most of the books / courses I see on the internet "always" are under the name "PHP and MySQL" being that courses and book of other languages do not have this addition of "and MySQL".

Is PHP so dependent on DB like this, or do you have another explanation for this?

    
asked by anonymous 08.04.2016 / 23:28

2 answers

1

First, PHP is a programming language and MySQL is a SGDB (database). Both are distinct and independent of each other.

The fact of finding many materials addressing the two is because they are the most popular. Simply this.

Packages

What you will most find is materials with the LAMP or WAMP set:

L->Linux
A->Apache
M->MySQL
P->PHP

W->Windows
A->Apache
M->MySQL
P->PHP

Another popular set is XAMP

X->Windows, Linux, OS-X (mac)
A->Apache
M->MySQL
P->PHP

Why is the LAMP set so popular?

Simply because there are no licensing costs, they are open-source and can be used commercially.

But then you ask why there is little or no material for PGSQL (postgre)? After all it is also an open source database.

At this point we are talking about capitalism.

Capitalism, marketing

In an analogy, you have a bar where it offers 2 beers. One is popular and widely accepted the other is as good as but little known. To attract customers to your bar you will not put a sign on the door with the unknown brand of beer. Customers would go straight and go to another bar where there is a poster with the popular beer usually accompanied by the image of a person famous at the time.

That is, a book titled "php and mysql" will sell much more than a "php postgre" book.

Hosting servers also give preference to the most popular and low-cost suites, in the case of LAMP.

MariaDB

obs: You will find many packages encouraging MariaDB and discouraging the use of MySQL. This is a long discussion and controversial subject so it is not possible to comment here. But basically MariaDB is MySQL. It was born after a dispute between the creator of MySQL and Oracle.

    
09.04.2016 / 09:41
4

Not that PHP is "so" dependent on databases, just that you can not easily solve so many problems with just programming languages.

To cite an example that appears a lot here in StackOverflow: how to send emails from forms. This is one thing you can do with only one programming language, no database required. But making a "bakery" system is already much more complicated to do without a database. It is not impossible, but neither is it easy, or desirable. This is because databases implement the ACID template , which helps a lot when you do not have concurrent concurrent requisitions. And that otherwise you would have to implement at hand, in the absence of databases.

Basically the courses are selling and database programming language "in an explicit way, since the combination of PHP and MySQL is very common (see LAMP ). Books that do not explicitly include a bank are probably only explaining the language itself, whereas the courses probably teach bank, just not putting in the course name it.

    
08.04.2016 / 23:38