I'm hosting off hostingmatters.com and they provide php and cgi wrapper. Before, I had the problem of creating new files from php scripts and they became undeletable. Then I was suggested to use CGI WRAPPER and run the scripts from a folder called scgi-bin. I've chmod all the files to 700 and 755 and they both do the same thing - I can't get one of 2 scripts to run, which create an error, that worked fine in the other folders.
I can get the first script to execute fine, all it does is read the file into a textbox like I'm typing in now. But I have another script that it goes to that actually overwrites the old data with the new data that you type in the textbox. I'm attaching the script that doesn't seem to work. But the first script only reads the file, so there are usually never any problems with reading a file, its with writing it. It worked fine in the other directories accept for the fact that if it was creating a new file, the file would be undeletable. So I'm attach the script that edits/creates specified files. I doubt it is the script, but just take a look. Its very simple:
#!/usr/bin/php
<?php
$AFile = fopen ($type, "w");
$newfile = stripslashes($art);
if (fputs($AFile, $newfile)) {
fclose($AFile);
echo "File has been edited successfully!<br>\n";
echo "Or click <A HREF=\"edit.php\">here</A> to go back.\n";
} else {
fclose($AFile);
echo "Error occured. File was not edited.<br>\n";
echo "Please contact website administrator.<br>\n";
echo "Click <A HREF=\"edit.php\">Here</A> to go back.\n";
}
?>
$type = the file name and location from the form that it is sent from.
$newfile = the data that has been edited.
This is the error I get (even with chmod 700):
scgiwrap: could not run the cgi script/binary
And yes I know that in order to edit or write to a file it must be chmod 777.
Any Ideas? Thanks. And I have already been to the admin of my hosting company and they are the ones that gave me the php path at the beginning of the script.
-- NevaFuse