473,396 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

fopen() question

hello, i just recently started getting permission errors when writing
to a file that's been working fine for a couple weeks now. i have made
no changes to the file or folder permission settings and i was
wondering if anyone knew of any other factors that could cause these
types of errors below. thanks in advance for a help with this problem.
aaron;

$content = "my file content";

// create a filename variable with the .iif extension for Quick Books
$filename = "qbprod.iif";

// delete old file so a new file can be created
unlink($filename);

// create a new file
$handle = fopen("/home/mysite/www/qbdata/$filename", 'a');

// write the contents to the file
fwrite($handle, $content);

// have dialog box prompt the user to open or save the file
header("Location:
http://www.mysite.com/qbdata/get_file.php?filename=$filename");

Warning: Unlink failed (No such file or directory) in
/home/www/mysite/qbdata/get_product_data.php on line 112

Warning: fopen("/home/goknobs/www/qbdata/qbprod.iif", "a") - Permission
denied in /home/www/mysite/qbdata/get_product_data.php on line 115

Warning: Supplied argument is not a valid File-Handle resource in
/home/www/mysite/qbdata/get_product_data.php on line 118

Warning: Cannot add header information - headers already sent by
(output started at /home/www/mysite/qbdata/get_product_data.php:112) in
/home/www/mysite/qbdata/get_product_data.php on line 121

Dec 30 '05 #1
3 1472
Did you TRY to reset the folder permission, by chance? Also, is this
being hosted on your own personal system or is it leased space? If it
is not your own system, they may be working on something. Just a
thought.

Dec 31 '05 #2

Slant wrote:
Did you TRY to reset the folder permission, by chance? Also, is this
being hosted on your own personal system or is it leased space? If it
is not your own system, they may be working on something. Just a
thought.


i found out it was something to do with apache assigning the file with
"nobody" permissions. not sure why it started do that out of the blue,
but the host fixed the problem.

aaron;

Dec 31 '05 #3
Well this may be happening because of some server updates, you should
check beside permissions also if you still own those files, meaning
you should check the user and group those files are associated with!

If you are hosted by a third party try contacting them to fix the
problem!

Hope it helps, Ovidiu

Dec 31 '05 #4

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

Similar topics

5
by: Shaoyong Wang | last post by:
Dear All, I want to write a simple PHP code to verify whether a given list of URLs is broken or not. The URLs given have various formats, for example, http://www.afro.com/history/history.html...
4
by: Robert Schott | last post by:
Hi .. this is for sure the 1k question on fopen but maybe can someone tell me this weird staff if i'm writing: $H = fopen($value,"r"); while(!feof($H)) { $string = fgets($H,1024); .... .......
3
by: Ming | last post by:
When I use fopen on the URL: fopen("http://home.pchome.com.tw/world/qoo4ko/110.jpg";, "r") I would get the following error message: -----------Error Message------------ Warning: fopen():...
7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
10
by: Grocery Clerk | last post by:
I know open() returns a file descriptor and fopen() returns a pointer to FILE. The question is, when do I use fopen() and when do I use open()? Could someone give me an example when to use one...
10
by: Longfellow | last post by:
Newbie here... My reading of the description of fopen() led me to expect that, with mode as "w", it would create a file if it did not exist. Checked the FAQ and did not see this question...
6
by: rfhurley | last post by:
I'm a newbie at this... I'm trying to run a PHP script from the W3C PHP tutorial, and the example shows the following code: <html> <body> <?php $file=fopen("welcome.txt","r"); ?>
10
by: Julia | last post by:
Hi, there, I am trying to append a binary file by using: FILE *strean; stream = fopen( "c:\temp.dat", "ba+" )); Is there a way that I can check if the file exists or not before fopen,...
25
by: subramanian100in | last post by:
Consider the following program: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv) { if (argc != 2) { printf("Usage: <program-name<text-file>\n");
20
by: cscorley | last post by:
For some reason, I cannot use fopen() on the file in write mode. The file "time" is in the same directory as the .php file, with permissions set to 0766. PHP Version 5.2.5 Apache/2.2.8 code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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
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,...

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.