Solved

Writing to file

Posted on 2000-03-25
2
261 Views
Last Modified: 2006-11-17
I want to create a new php page from a form.

It works fine offline but when I upload on my server I've got those errors :

Warning: SAFE MODE Restriction in effect. The script whose uid is 98 is not allowed to access ./inc/top_nav.inc

I guess that's because my file should be executable... how could I do that?

    $fp = fopen("newfile.php3", "w");
    fputs($fp, "<HTML>\n");
    fputs($fp, "<HEAD>\n");
    fputs($fp, "<TITLE></TITLE> ");
    fputs($fp, "<? include(\"inc/top_nav.inc\");?>\n");  
    fputs($fp, stripslashes($Content));
    fputs($fp, "</BODY>\n");
    fputs($fp, "</HTML>\n");
    fclose($fp);

 
0
Comment
Question by:cybernietic
2 Comments
 
LVL 8

Expert Comment

by:us111
ID: 2657110
UID is the permissions of your script.
Do you have permissions to write into file on your server ?

try
<?
$o = fileowner("newfile.php3");
print "$o\n";
$o = fileowner("otherfile.php3");
print "$o\n";
?>
and look if the owner is the same.

and then.....wait.... for another comment (just for cibernietic : clear your quiche)

Euh, if you have full access to your server you can change the permissions otherwise it will hard.

Hmm my comment seems to be stupid. :)
0
 
LVL 12

Accepted Solution

by:
j2 earned 40 total points
ID: 2657324
Warning: SAFE MODE Restriction in effect. The script whose uid is 98 is not allowed to access ./inc/top_nav.inc

Means that the web process is running with UID 98, and when PHP has "safe mode" enabled, no UID > 1024 will be allowed to do thi.

Either you have to disable safemode
(safe_mode               =       Off) in php3.ini or you will have to move your webserver to run as a UID < 1024
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question