Solved

Writing to file

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now