Go Back   Tech Support Forum > Design Forum > Web Serving and Management

User Tag List

failed to open stream: Permission denied

This is a discussion on failed to open stream: Permission denied within the Web Serving and Management forums, part of the Tech Support Forum category. i use a VPS through digitalocean and currently run fedora 21x64. I've installed the lamp stack as a fresh install


Closed Thread
 
Thread Tools Search this Thread
Old 05-31-2015, 02:09 PM   #1
Registered Member
 
Join Date: May 2015
Posts: 1
OS: win 7 / fed 21 server lamp stack



i use a VPS through digitalocean and currently run
fedora 21x64. I've installed the lamp stack as a fresh install since I've been stuck for 2 weeks trying different ideas I was afraid I messed up too much internally.

I'm trying to run the following code under /var/www/html called makefile.php

<?php
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Bopper\n";
fwrite($fh, $stringData);
$stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);
fclose($fh);

?>


I can execute the command line version of the php file(su apache , cd to dir and running code). It does end up working. However when I try it online through the browser I still get the permission denied in the logs.
Current group/owner is root:root for
/var/
Current group/owner is apache:apache for

/var/www
/var/www/html .

I've used

get_current_user();
current script owner is apache

whoami

apache

I placed the same file in all directories and it worked under the command line version.
/var/makefile.php
/var/www/makefile.php
/var/www/html/makefile.php

The oddest thing is, i tried a work around where I told the php script to write to
/var/orders (who's current directory owner is root and it created a text file with the owner of the text file bring apache:apache) using the same fopen commands.
I have since changed the owner/group to apache:apache and nothing has changed, it can save text into /var/orders but it can't go to the www folders. Here is the permissions under ls -la and acl

getfacl /var/
getfacl: Removing leading '/' from absolute path names
file:var
owner:root
group:root
user::rwx
group::rwx
other::rwx

getfacl /var/orders
getfacl: Removing leading '/' from absolute path names
file:var/orders
owner:apache
group:apache
user::rwx
group:rwx
other:rwx

getfacl /var/www
getfacl: Removing leading '/' from absolute path names
file:var/www
owner:apache
group:apache
user::rwx
group:rwx
other:rwx

getfacl /var/www/html
getfacl: Removing leading '/' from absolute path names
file:var/www/html
owner:apache
group:apache
user::rwx
group:rwx
other:rwx

(for folder var)
ls -la
drwxrwxrwx 20 root root 4096 May 31 19:35 var

(for folder /var/www & /var/orders)
ls -la
drwxrwxrwx 4 apache apache 4096 May 31 19:33 www
drwxrwxrwx 4 apache apache 4096 May 31 19:38 orders

I'm at a loss as to why it won't execute to create a file under /var/www/ or /var/www/html but only /var/orders even though it looks like they have they same exact permissions.
steveh627 is offline  
Sponsored Links
Advertisement
 
Old 06-01-2015, 01:45 PM   #2
Moderator
- Design Team
- Networking Team
 
Fjandr's Avatar
 
Join Date: Sep 2012
Location: Spokane, WA
Posts: 2,483
OS: Windows XP SP3, Windows 7 SP1, Debian, CentOS

My System


Do you have PHP error reporting enabled?

Try using error_get_last() or (if you are using a version < 5.2) track_errors to perhaps get a better idea of exactly what is going wrong with your permissions.
__________________

Fjandr is offline  
Old 06-03-2015, 11:42 AM   #3
Manager
- Alternative Computing
- Design
 
wmorri's Avatar
 
Join Date: May 2008
Location: New York
Posts: 6,492
OS: Window 7/Ubuntu/Fedora/Backtrack 5

My System

Send a message via AIM to wmorri Send a message via MSN to wmorri

Also I would like to see if you php in running or not. Create a file called info.php and post the following

PHP Code:
<?php info(); ?>
Then we can make sure that php in enabled and running.
__________________


Linux Forever!|html5 boilerplate
wmorri is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
DirectX?
Hello. I have been having a few issues with my PC gamins lately, many of them have stopped working and I now receive these messages since upgrading to the latest Nvidia driver. Rolling it back does not seem to help either. https://i429.photobucket.com/albums/qq12/organicmagic/2_zpsgxgj3yra.jpg...
epistretes PC Gaming Support 3 05-26-2015 02:20 PM
Can't remove ROOTKIT virus on Win7
Hello, remove them with that programm. I have Normally i use mac OS Snow Leopard, but I have also Win7. My mac started to be unusually slow and now I can't type or click. I ran Avast and he found infected files only on Win7. I tried to remove them, but i couldn't and I also couldn't move them...
Mimy_88 Inactive Malware Help Topics 8 06-27-2013 04:44 AM
Happili Redirect and other possible issues
. DDS (Ver_2011-08-26.01) - NTFSx86 Internet Explorer: 9.0.8112.16421 Run by aim at 20:04:26 on 2012-05-02 Microsoft® Windows Vista™ Home Premium 6.0.6002.2.1252.1.1033.18.2037.972 . AV: Microsoft Security Essentials *Enabled/Updated* {9765EA51-0D3C-7DFB-6091-10E4E1F341F6} SP: Windows...
nivedx Resolved HJT Threads 18 05-06-2012 12:43 PM
[SOLVED] VCExpress Problem, Probably AppData\Permissions Problem?
I think it should be related to this forum because I think the problem is something with AppData \ Permissions which is related to Windows 7. I'm having a problem while running\installing Visual C++. The problem started 2 days ago, it did work before. When I'm trying to run I'm getting this...
benben12 Windows 7 , Windows Vista Support 8 02-09-2011 12:45 PM
Need some help. Virus/malware Thanks!
:upset: Tons of popup windows saying this file is infected and that file is infected, do I want to open up my security software (and this isn't my CA security suite doing this). Even if I'm using Firefox random windows in IE will open with (******.com/porno.com/adult.com). Hardly any...
R_Willis Inactive Malware Help Topics 7 01-20-2011 09:50 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2
Powered by vBadvanced CMPS v3.2.3


All times are GMT -7. The time now is 06:51 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.1.0 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright 2001 - 2018, Tech Support Forum

Windows 10 - Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts