Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does PHP communicate with MySQL on the same server

Tags:

php

mysql

Does anyone know how php requests data from mysql?

If I have mysql in the same machine as php, does it open a tcp connection to the localhost on port 3306 or does it have some other way of getting the data?

Is it the same in linux and windows?

Thanks

like image 285
AntonioCS Avatar asked Dec 22 '22 09:12

AntonioCS


1 Answers

if available it uses a unix socket, otherwise localhost.

Note that even if you specify localhost in the connection string it will try to use the faster "unix socket" if available

like image 154
drAlberT Avatar answered Jan 11 '23 05:01

drAlberT