Article 4ZE23 failed to open stream: Permission denied

failed to open stream: Permission denied

by
pizzipie
from LinuxQuestions.org on (#4ZE23)
Hi,

I keep getting the subject message while trying to open a file. I have changed all the permissions to 777 on the directory which will contain the new file . Don't know where to go from here to fix this.

Code:<?php

error_reporting (E_ALL ^ E_NOTICE);
include("../myPhpFunctions.inc");

if(isset($_POST['submit_row'])) {
$host="localhost";
$username="rick";
$password="";
$databasename="optumRx.db";

$id=$_POST['Id'];
$acctfor=$_POST['AcctFor'];
$invdate=$_POST['InvDate'];
$orderno=$_POST['OrderNo'];
$drugno=$_POST['DrugNo'];
$description=$_POST['Description'];
$cost=$_POST['Cost'];
$refills=$_POST['ReFills'];

$inputFile= fopen("optumRxInputFile.sql", "a+") or die("Unable to open file!");

for($i=0;$i<count($invdate);$i++) {

if($acctfor[$i]='Enter AcctFor') $acctfor[$i]='p'; // default value
if($refills[$i]="Enter ReFills") $refills[$i]=0; // default value

$str = "insert into rxdata values('".$acctfor[$i]."','".$invdate[$i]."','".$orderno[$i]
."','".$drugno[$i]."','".$description[$i]."',".$cost[$i].",".$refills[$i].")";

echo $str."</br>";

fwrite($inputFile, $str);

} // for

fclose($inputFile);

} // isset
?>
I created a test file that works ! It appears that this happens only when you try to run 'action' program on the <form>.

Code:<?php

error_reporting (E_ALL ^ E_NOTICE);
include("../myPhpFunctions.inc");

$inputFile= fopen("optumRxInputFile.sql", "a+") or die("Unable to open file!");

$str = "insert into rxdata values()";

echo $str."\n";

fwrite($inputFile, $str);

fclose($inputFile);

?>Don't know where to go here to fix this.latest?d=yIl2AUoC8zA latest?i=PBq5AL4LJOs:fMDMdvxjUys:F7zBnMy latest?i=PBq5AL4LJOs:fMDMdvxjUys:V_sGLiP latest?d=qj6IDK7rITs latest?i=PBq5AL4LJOs:fMDMdvxjUys:gIN9vFwPBq5AL4LJOs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments