473,566 Members | 3,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

flock() Permission denied error

Hello,
when using flock() I get a permission denied error:

Warning: fopen("<filenam e>", "r+") - Permission denied in <pathtofile>
on line 7

I do this:

$fileToOpen=sub str($PHP_SELF, strrpos($PHP_SE LF,"/")+1);
$fileHandle=fop en($fileToOpen, 'r+') or die($php_erorms g);
flock($fileHand le,LOCK_EX | LOCK_NB);
$fileString=fre ad($fileHandle, filesize($fileT oOpen)) or
die($php_erorms g);

// ,,
// procesing of filecontents
// ,,

rewind($fileHan dle);
if(-1==fwrite($file Handle,$newFile )) {die($php_error msg);}
ftruncate($file Handle, ftell($fileHand le)) or die($php_errorm sg);
flock($fileHand le,LOCK_UN);
fclose($fileHan dle);

It seems to me that I incorrectly place the flock()'s but the manual
suggest putting flock($fileHand le,LOCK_EX) after the fopen() and the
flock($fileHand le,LOCK_UN) before the fclose()...

Placing the flock($filehand le, LOCK_UN) just before the fclose()
produces the same result...

All I can do from that point on is to delete the file and use a new
(copy of the unaffected) file...

php4.1.2
MacOSX 10.2

Marc
Jul 16 '05 #1
0 2257

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

Similar topics

3
9557
by: msnews.microsoft.com | last post by:
I'm running a intranet site on a NT 4.0 IIS 4 server. I have a page that uses CDONTS. I recently change this intranet application to run as an isolated process (Selecting the checkbox "Run in separate memory space"). Now every time I get to the line objMail.Send, I get a permission denied message (Microsoft VBScript runtime error '800a0046'...
6
7859
by: Jon Montana | last post by:
CDONTS was working well until I installed Exchange 2000. I thought it might be a relay problem, but I allowed the server IP address to relay. Thanks for anything you can offer. here's the error: HTTP 500.100 - Internal Server Error - ASP error Internet Information Services
3
19143
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
1
4312
by: Mark E. Hamilton | last post by:
Sorry, I probably should have re-stated the problem: We're using Python 2.3.5 on AIX 5.2, and get the follow error messages from some of our code. I haven't yet tracked down exactly where it's coming from: sem_trywait: Permission denied sem_wait: Permission denied sem_post: Permission denied
10
4561
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more precisely, it updates that table to change the search_path temporarily). With the postgres 7.3 (and 7.4 too) installed on my debian development...
2
3670
by: Taishi | last post by:
New user of SQL Everything is on the same machine My error is close to the bottom After reading it today, I can see there is a problem with 2 dbases 'PUBS' and 'Master' There are also some comments from the group: ---microsoft.public.sqlserver.odbc-- subject: Permission Denied -- Thanks for help guys I was able to find a trial version of...
4
9074
by: stephen | last post by:
Hi, I am getting an error while trying to create an excel file. "Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details:...
4
19154
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); fclose(fp); Does this accomplish real locking, or just narrow down the race quite a bit? (Race existing between the unlock and the
0
3186
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to the destination table(DB2). I get the following error when the package is executed: The execution of the following DTS Package succeeded: ...
0
7673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.