I’ve got a webapp (basically a CMS) running on Apache built with PHP5/MySQL.
Which would be the best practice to create a demo version on the web?
The only way I can think of is duplicating the entire database for each new user and running a cron job one or twice a day to remove those duplicates.
What these guys said is fine, just make sure you have some measures in place to flag dodgy content. If your CMS allows picture uploads then people could upload all sorts of nasties.
You could also just create a new field in the database that stores users session IDs and only display the content that the particular user has uploaded/edited. Be a little more work but safer if your worried about dodgy content being published for all to see.