I'm a new comer to PHP although not programming generally. I wish to store some data I retrieve on the internet service but I don't think I would like a database for your. First, data is going to be up-to-date often and it is dimensions are always under 1MB. What's the best, fast but efficient approach in PHP on Apache? Note: I'm utilizing a host company so I don't prefer custom installations. Possibly, singleton? Thanks

Make use of a database. Or else you are stuck serialising personal files. But to get this done right you have to implement concurrency controls.

Save the time and effort and employ a database.

I believe the question becomes, how lengthy will the information be saved for? If you're storing the information until it's changed or more than just one user session, personally In my opinion a database is the perfect solution - it is made to be extremely powerful with rapidly changing and locating data.

When the information is only stored for any single user session, you could utilize PHP periods to keep the information being an array.

Another alternative would be to keep data inside a file. However, this is often a smaller amount efficient in locating small quantities of data.

Use a set file. If you don't have to inflict kind of fancy searches, that's.

The apparent option to the database is file storage. PHP can read traditional disk files see fopen(), fread(), fwrite() and more. You will need to designate a folder around the server (besides the public_html space) for file(s) and develop a naming plan and data format.

You could utilize a Cloud service (Amazon . com, Google ...). But aside from making your application more complecated and brittle and yourself more stylish I do not use whatever benefit over utilizing a normal db or perhaps a flat file.

You could lay aside arrays inside a plain text file, with serialize.

Something similar to

$fh = fopen("db.txt", "w");
fwrite($fh, serialize(array("field"=>"data"));

Retrieve it again with fread and mode "r" and so the method unserialize.

$fh = fopen("db.txt", "r");
$data = unserialize(fread($fh));

After which manage your computer data within the array.

You are able to store your computer data in xml files and employ an simplexml to load the information an keep it in check, like:

$xml = simplexml_load_file("test.xml")

You'll be able to have a listing from the nodes you defined and do your stuff. For more reference you should check out the next:

SimpleXML tutorial