Solved

Writing to file

Posted on 2000-03-25
2
264 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

839 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