General discussions related to php
Moderators: macek, egami, gesf
- php-forum Fan User
- Posts: 578
- Joined: Fri Aug 05, 2011 9:53 am
A lot of software works by sending requests to various ports ( or sockets ), but usually each package has it's own 'language' if you'd like to call it that. The client software ( which is what your talking about ) needs to know what commands to use and how to interpret the responses.
If you look at MySQL - it uses port 3306 by default, so if you know how to communicate with MySQL, you can talk to that port and execute SQL. Note that when you connect to MySQL from PHP - you use
Code: Select all
$con = mysql_connect("localhost","peter","abc123");
die('Could not connect: ' . mysql_error());
// some code
The 'localhost' is the server to connect to and this will connect using the default port - 3306. PHP acts as a client to the MySQL database and sends commands and receives data through this socket.
Who is online
Users browsing this forum: No registered users and 1 guest