I am new to php and am on chapter 2 PHP and MySQL by Welling and Thomson.
When executing the code from the example to write the output data string:
// open file for appending
@ $fp = fopen("../../orders/orders.txt", "a");
flock($fp, 2);
if (!$fp)
{
echo "<p><strong> Your order could not be processed at this time. "
."Please try again later.</strong></p></body></html>";
exit;
}
fwrite($fp, $outputstring);
flock($fp, 3); //line 56
fclose($fp);
The processorder.php page opens and the screen output is ok. Then I get the
following message below the order echos:
Warning: flock(): supplied argument is not a valid stream resource in
c:\inetpub\wwwroot\phptest\PROCESSORDER.PHP on line 56
Any advice of where I might find information on why I get this message will
be appreciated.
Bert 3 1576
Sorry, the error occured on the first call to flock as indicated below.
"Bert" <be*********@meckcom.net> wrote in message
news:C4******************@fe07.usenetserver.com... I am new to php and am on chapter 2 PHP and MySQL by Welling and Thomson.
When executing the code from the example to write the output data string:
// open file for appending @ $fp = fopen("../../orders/orders.txt", "a");
flock($fp, 2);
if (!$fp) //line 56 { echo "<p><strong> Your order could not be processed at this time. " ."Please try again later.</strong></p></body></html>"; exit; }
fwrite($fp, $outputstring); flock($fp, 3); fclose($fp);
The processorder.php page opens and the screen output is ok. Then I get
the following message below the order echos:
Warning: flock(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\phptest\PROCESSORDER.PHP on line 56
Any advice of where I might find information on why I get this message
will be appreciated.
Bert
"Bert" <be*********@meckcom.net> wrote in message
news:C4******************@fe07.usenetserver.com... I am new to php and am on chapter 2 PHP and MySQL by Welling and Thomson.
When executing the code from the example to write the output data string:
// open file for appending @ $fp = fopen("../../orders/orders.txt", "a");
flock($fp, 2);
if (!$fp) { echo "<p><strong> Your order could not be processed at this time. " ."Please try again later.</strong></p></body></html>"; exit; }
fwrite($fp, $outputstring); flock($fp, 3); //line 56 fclose($fp);
The processorder.php page opens and the screen output is ok. Then I get
the following message below the order echos:
Warning: flock(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\phptest\PROCESSORDER.PHP on line 56
Any advice of where I might find information on why I get this message
will be appreciated.
Bert
That error means the file couldn't be opened.
Put that flock() after your if(!$fp) block, and you will probably see your
custom error message.
"jn" <us********************************@jasonnorris.ne t> wrote in message
news:R%*********************@twister.tampabay.rr.c om... "Bert" <be*********@meckcom.net> wrote in message news:C4******************@fe07.usenetserver.com... I am new to php and am on chapter 2 PHP and MySQL by Welling and
Thomson.
When executing the code from the example to write the output data string:
// open file for appending @ $fp = fopen("../../orders/orders.txt", "a");
<snip> The processorder.php page opens and the screen output is ok. Then I get the following message below the order echos:
Warning: flock(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\phptest\PROCESSORDER.PHP on line 56
Any advice of where I might find information on why I get this message will be appreciated.
Bert
That error means the file couldn't be opened.
Put that flock() after your if(!$fp) block, and you will probably see your custom error message.
You're using a relative path, so you might like to check where you are - you
might be surprised. Also check file/directory permissions - your web server
account needs to be able to access the file.
Garp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dino |
last post by:
dear all,
i've created an application for a customer where the customer can upload
..csv-files into a specified ftp-directory. on the server, a php-script,
triggered by a cronjob, reads all the...
|
by: Kamus of Kadizhar |
last post by:
Thanks to Robert Brewer, I got enough insight into logging to make it work....
Now I have another issue: file locking. Sorry if this is a very basic
question, but I can't find a handy reference...
|
by: Corne' Cornelius |
last post by:
Hi,
When you open a file for writing/appending with open() or fopen(), and
you have multiple applications that might want to write to the same file
at the same time, could that cause weirdness...
|
by: Stephen Corey |
last post by:
I'm writing an app that basically just appends text to a text file on a
Win2K Server. They fill out a form, click a button, and 1 line is
appended to the file. Multiple people will run this app at...
|
by: darrel |
last post by:
I've been dealing with a file locking issue for a while.
Our CMS spits out a new XML file each time an item in the DB is updated.
This XML file is basically our site menu, and is what we use on...
|
by: ABCL |
last post by:
Hi All,
I am working on the situation where 2 different
Process/Application(.net) tries to open file at the same time....Or one
process is updating the file and another process tries to access...
|
by: George |
last post by:
Hi,
I am re-writing part of my application using C#. This application starts
another process which execute a "legacy" program. This legacy program writes
to a log file and before it ends, it...
|
by: shineofleo |
last post by:
Here is the situation: I wrote a VB programm, which stores all the
information in a single Access database file using jet engine. It
worked well, however one of my customs reported that there was...
|
by: Amir Michail |
last post by:
Hi,
Trying to open a file for writing that is already open for writing
should result in an exception.
It's all too easy to accidentally open a shelve for writing twice and
this can lead to...
|
by: Matt Brandt |
last post by:
I am trying to get multiple threads to lock specific regions of a file.
However, since each thread has the same PID, it appears that a lock by
one thread does not block another thread from the same...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |