7

What is a static file? What does it mean "to serve static files"?

5 Answers5

8

The opposite of a dynamic file :) It means that the file content will be sent to the client (usually a browser) as is without server intervention. By contrast, a dynamic file is parsed by the server which then renders a new set of data based on the dynamic file template. A dynamic file will typically use some form of server-side code to let the server know what type of modifications need to be made.

PinnyM
  • 35,165
  • 3
  • 73
  • 81
4

A static file is something like:

  • index.html
  • style.css
  • script.js
  • image.jpg

Basically, anything which is not a PHP script, and anything which is not dynamically generated by your web server.

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
2

It's a file that doesn't change. There isn't any logic running to generate what you see as there would be on a page with "dynamic" content.

Jordan Kaye
  • 2,837
  • 15
  • 15
1

It means that server will not be used to produce a file.

When you ask for a *.css or an image - the server does not intervene, whereas if you ask for *.php file a server needs to generate it before giving it back.

http://support.exsitewebware.com/cgi/page.cgi/articles.html/Content_Management/Static_vs_Dynamic_Content

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
0

When people talk about static/dynamic files, they talk about how the file is GENERATED.

A file like index.html can be a "dynamic" file, in a sense that it is dynamically GENERATED (using a server which reached out to a database, some API, some code etc.)

anemaria20
  • 1,646
  • 2
  • 17
  • 36