Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Writing to file

Posted on 2000-03-25
2
Medium Priority
?
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 120 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
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.

688 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