?
Solved

Permision Denied on PHP OS X desktiop file

Posted on 2014-01-04
4
Medium Priority
?
575 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

764 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