I learn PHP from now. And for create a dynamic website usually use PHP + MYSQL(For database).

In PHP have function like fopen() to create, write result from form to a file like txt or other.

My Question is, is it possible to create a dynamic website without a database? (For very small Website maybe)?

Im very Appreciated your advice


6 Answers 6


It depends on how complex your web is.

I assume your web is contact mangager (create,update,delete) for 1 user only, you can storage records in a csv file on web server, it's not too difficult.

But if your contact manager serve many users, you have to implement concurrency, transaction for you text file. Its not easy.


The problem you are going to face is called a race condition. Concurrency control is what controls concurrent access to a resource.

The easiest way to avoid race conditions is to use mutex locks. This way only one person at a time can access it. Note that you cannot write your own lock systems since it still has a race condition. A mutex must be part of the language. The problem with a lock is that the other person has to wait for access.

Compared to a database concept it is a slow process.


Here is a very useful application called elog. It h stores its information in files. It is not implemented as Apache+PHP but has its own webserver written in C.

It is a weblog. A post is saved as text file in a directory. The text file has a special format so that the fields of the post can be saved.


Hey dude you can use STATAMIC . This is a flat file CMS. It stores the data in to files. Have a try at this. This may hep you. And it works for me. :)


Yes, it is possible. However, it's highly discouraged! Unless the site is very simple, and has only one person contributing to it, you will experience issues.

You should be looking at file_put_contents() and file_get_contents(), or perhaps file() for the proper functions for handling files. Using file handles directly is the old, and rather cumbersome method.


I think you can. it can be some kind of application, for example bmi calculator. you can use "get" method for collect data from user and store data in variable then do something with them and send that user to specific page related to his bmi result. But I am interested what will happen if two users, at the same time access application

Not the answer you're looking for? Browse other questions tagged or ask your own question.