1

I'm working on a big internet project. I'm writing code in PHP, and I need some advice.

My website has both dynamic and static pages. The dynamic pages get contents from a MySQL DB. But I want to put the contents of the static pages into the MySQL DB tables too. Is it a good idea? Please explain me pros and cons if you think that it's not good idea.

0

3 Answers 3

3

Pros: you can write your own content management system. Cons: one million people before you wrote a content management system in PHP, and a lot of them are bound to be better at it than you. So if you want this, for starters check out how (not whether ;-)) to integrate an existing PHP CMS.

Static pages in the database are fine, as long as you're aware that they will have more processing overhead for a request than a pure static page served e.g. directly from Apache. However, it's usually easy to fix this by putting a caching proxy in front of your database-stored static pages - as long as you make sure to put the correct cache-control headers on all responses, it's quite simple to setup.

Sign up to request clarification or add additional context in comments.

Comments

1

A lot or projects work hard into creating cache systems to put dynamic contents into static caches. This is a self explanatory answer. Accessing a file cache is faster than rendering dynamic contents, so instead of putting everything in a database, why don't you try to exact opposite? This does not mean to have a static web site and drop the database altogether, but rather keep a balance between static and dynamic content and use cached data as much as possible.

Comments

1

Many sites change on their server, this means they change dynamically made pages to static ones.

A dynamic page uses more of the server than a static page will. In other words - more static pages less load on server, because it doesn't need to parse it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.