Avatar of sharingsunshine
sharingsunshine
Flag for United States of America asked on

Permision Denied on PHP OS X desktiop file

I have a csv desktop file that I have chmoded the permissions to 777 and 775 and still the program won't open the file.

Here is what I have

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<?php
$file = fopen("/Users/abx/Downloads/weight_nsp_ben.csv","r");
print_r(fgetcsv($file));
fclose($file);
?>

<body>
</body>
</html>

Open in new window


Warning: fopen(/Users/abx/Downloads/weight_nsp_ben.csv): failed to open stream: Permission denied in /Users/rjw/Sites/sandbox/test_weight.php on line 9

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /Users/abx/Sites/sandbox/test_weight.php on line 10

Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/abx/Sites/sandbox/test_weight.php on line 11

Open in new window

Mac OS XPHP

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
Tom Beck

Can you edit your php.ini file? Look for a value like this:

allow_url_fopen = off

Change to:

allow_url_fopen = On

And add or change this line below it:

If:

allow_url_include = off

Change to (or add):

allow_url_include = on
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sharingsunshine

ASKER
Worked great putting it in the same directory.  I had a permission error on trying to modify php.ini.
Dave Baldwin

Glad you got it working.  There is a 'block' of sorts between the GUI and the command line in OSX.  Some things can only be accessed thru the 'Terminal' app.  I think they did that to get keep less sophisticated users from screwing up their computers.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy