Solved

Permision Denied on PHP OS X desktiop file

Posted on 2014-01-04
4
557 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
Comment Utility
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 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
Worked great putting it in the same directory.  I had a permission error on trying to modify php.ini.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

10 Experts available now in Live!

Get 1:1 Help Now