Solved

Permision Denied on PHP OS X desktiop file

Posted on 2014-01-04
4
561 Views
Last Modified: 2014-01-04
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

0
Comment
Question by:sharingsunshine
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 39756317
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
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39756393
Put the CSV file in the same directory as your PHP file for a test.  OSX is an interesting combination of BSD Unix and proprietary Apple code.  I think that means that permissions are not necessarily straight forward.
0
 

Author Closing Comment

by:sharingsunshine
ID: 39756474
Worked great putting it in the same directory.  I had a permission error on trying to modify php.ini.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39756500
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.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
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…

815 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

7 Experts available now in Live!

Get 1:1 Help Now