473,498 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

flock or database

Hi,

I have written a simple guestbook in php which writes the contents in a
file while using flock. But I have read that this is not always save.

So some people suggested to use a database instead. But if I use mysql,
then my customers have to pay more for the webspace. Actually, I would
prefer to use a simple database like dbm
(http://www.php.net/manual/de/ref.dbm.php) and write the information in
a local file.

Under http://www.php.net/manual/de/ref.dbm.php in the last not of the
User Contributed Notes some says that the return codes are nadly
documentated or wrong.

Is dbm a save way to give several scripts/processes at the same time
the ability to read/write from the same file. Or are there maybe others
which php programmers prefer. But remember I want to write the data to
a file and not to database service...

Thanks a lot...

Nov 22 '05 #1
2 1434
NC
hakim wrote:

I have written a simple guestbook in php which writes the contents in a
file while using flock. But I have read that this is not always save.
It is not safe on Windows. But you are not going to host your
guestbook on a Windows machine, are you?
So some people suggested to use a database instead. But if I use mysql,
then my customers have to pay more for the webspace. Actually, I would
prefer to use a simple database like dbm
(http://www.php.net/manual/de/ref.dbm.php) and write the information in
a local file.


But then you'd have to talk your hosting company into enabling dbm
support. Would they go along with that for free?

Cheers,
NC

Nov 22 '05 #2
NC schrieb:
It is not safe on Windows. But you are not going to host your
guestbook on a Windows machine, are you?
No it's a debian box...
But then you'd have to talk your hosting company into enabling dbm
support. Would they go along with that for free?


That's true. But are there some nice file - database solutions other
then dbm, which don't need to be compiled into php??

I have looked for sqlite, but this seems to be experimental...

hakim

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2248
by: Marc | last post by:
Hello, when using flock() I get a permission denied error: Warning: fopen("<filename>", "r+") - Permission denied in <pathtofile> on line 7 I do this: $fileToOpen=substr($PHP_SELF,...
14
3125
by: deko | last post by:
Do I need to use flock() when reading a file into an array? It's possible that the file in question could be open at the time the file('filename') request is made. I realize flock() is required...
3
4763
by: Rex Karz | last post by:
Newbie here. I interpret the fine print at http://us2.php.net/manual/en/function.flock.php to mean that flock() does not work where the file being locked is on an NFS filesystem. The...
4
7830
by: writeson | last post by:
Hi all, I've got a PHP program that I've added flock() to in order to protect multiple scripts trying to write to the same file. After I added the flock() to the code the performance of the code...
3
2797
by: siliconmike | last post by:
I've scoured over manual page for flock on http://in2.php.net/flock but I can't understand a few things: 1. will flock wait until a different process releases the lock ? 2. please clarify this...
4
19139
by: Time Waster | last post by:
Is this a stupid use of flock: FILE *fp=fopen(SOME_FILE_CONSTANT,"r+"); flock(fileno(fp),LOCK_EX); something important here, including reads and a write to fp flock(fileno(fp),LOCK_UN);...
2
3634
by: xucs007 | last post by:
I ran following 2 programs (lock1, lock2) at almost same time, to write either "123456", or "222" to file "aaa" at the same time. But I often just got "222456" in "aaa" . Is this a bug of python...
1
1737
by: Seb | last post by:
I'm trying to implement a file server using the code below. However the locking doesn't work. I can delete while put'ing a file. Anyone got an idea about why? best regards, seb
6
4191
by: Bill H | last post by:
I am wondering if this is possible. I have a file that is accessed by multiple users and keeps track of activity (the file is polled by flash every 2 seconds). As users leave, the flash program...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7381
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.