Reputation: 832
If database server is out of web server Apache communicates with database server through TCP/IP protocol, but when database and Apache is on the same computer which is the protocol by which they communicate?
Upvotes: 0
Views: 399
Reputation: 35169
The option exists for a number of database servers - on Unix/Linux-like operating systems (such as MySQL or PostgreSQL) to use a Unix socket file. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you do not specify a host name or if you specify the special host name localhost
.
The socket file shows up as a special file in the file system (for MySQL, it defaults to /tmp/mysql.sock, unless that is altered in the server configuration).
Upvotes: 1