What actually happens in the background after php interpreter parses code that says, open a database connection, execute curl request, etc.?
I know this is a newb question, but I searched the archives and couldn't find an exact a开发者_如何学Pythonnswer to this. So when a php script is run and the php interpreter parses the script and finds code that says open a database connection and perform a query, how does this actually happen? What goes on in the background that actually fulfills this request?
The PHP script contacts the MySQL server in the same way you would use the Internet, only with a different protocol (instead of HTTP it uses MySQL's syntax). If you set the server to localhost it doesn't actually have to use the Internet but it still does the same stuff, just offline, in the same way as if you contact your own localhost via your browser. The data returned is sent back to the PHP script.
Like how HTTP uses port 80, MySQL uses port 3306. You could actually contact MySQL yourself outside of PHP technically.
im not sure im 100% correct :/
i think the answer is, when apache is loaded(started) the httpd deamon checks the php.ini file and loads up the various dlls that are set with LoadModule eg "LoadModule ssl_module modules/mod_ssl.so" and all the the dlls from the bin directory "have a look" there's lots of dll for most of the protocols, in this particular case when a mysql statement is passed through the purser libmysql.dll handles the internals.
精彩评论