Reputation: 1899
what is the order of execution in web ? PHP, HTML, Javascript, css and mysql are the items to execute
Upvotes: 3
Views: 5850
Reputation: 66032
Order of execution (When you first visit a page):
Server-side first, then client-side.
Web server handles request, then begins execution of server-side scripts.
PHP is server-side, so it'll execute first. Your using PHP to execute mysql queries and get data out of tables, correct? So during the execution of your PHP script(s), your mysql queries will execute. Then, when your PHP has finished executing, your client-side elements (HTML, Javascript, css) will get executed/be interpreted.
Upvotes: 1
Reputation: 17661
The order is like this:
Here is an example:
Server: execute index.php file on the server
<?php echo "Hello, world!;"; ?> <script>alert("hello!")</script>
Server: respond the output
<script>
detected, alert("hello!")
Upvotes: 6
Reputation: 38492
The answer is a little complicated, and part of it depends on your webserver. Part of the answer, in Apache, is in your DirectoryIndex setting. If you have several possible files, index.html, index.cgi, index.php, etc., this will determine which is used:
DirectoryIndex index.cgi index.php index.shtml index.html
ISS has a similar mechanism, but it's been years since I messed with it.
HTML and CSS are interpreted by the browser (client-side). Javascript is generally run on the client side, but some servers allow for server-side execution as well.
Mysql is run on the server, generally in response to a php or cgi script's query.
Upvotes: 1
Reputation: 944430
Anything server side will run, then anything client side will run (in the order it appears, although note that running some bits of code just sets up an event handler that contains code that will run when the event actually happens)
Upvotes: 0
Reputation: 1106
I can only recommand you a lot to view this talk by Steve Souders on JSConf : http://jsconfeu.blip.tv/file/3060565/
He talked about to best practices to optimise loading of your page on client side.
On the server side, you should know PHP stop execution until it get response from MySQL.
Upvotes: 0
Reputation: 42248
User makes a request -> handled by your web server (probably apache) -> handed off to php -> php builds html using mysql and returns it -> html is interpreted, and references css -> javascript executes on the client
Upvotes: 0