Solved

Permision Denied on PHP OS X desktiop file

Posted on 2014-01-04
4
565 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
[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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Migration email from Entourage to AOL 20 32
Compiling PHP with Curl plus protocols 8 25
iCloud for Desktop 3 33
Using Mac OSX on Windows 7 Professional 4 52
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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