Fedora Linux Support Community & Resources Center
  #1  
Old 25th October 2012, 02:21 AM
YellowDog Offline
Registered User
 
Join Date: Feb 2010
Posts: 53
linuxfirefox
Writing to a file with PHP

I am trying to writ to a file in /tmp but I can not. I'm guessing it's an Apache configuration issue, I've tried the same script on other non Fedora servers and it works fine.

$file = fopen( "/tmp/php.log", "a" );
$datetime = date( "M j, Y, G:i:s T" );
fputs( $file, "$datetime\n" );
fclose( $file );

I get no messages in the log. Any suggestions?
Reply With Quote
  #2  
Old 26th October 2012, 03:45 AM
Doug G Offline
Registered User
 
Join Date: Jul 2005
Posts: 640
linuxfirefox
Re: Writing to a file with PHP

selinux?
openbasedir restriction in php?
file permissions?

Turn on E_ALL error reporting in php & see if you get more info

Did you look in syslog and the apache error log for clues? There will be something logged somewhere if your script fails.
__________________
======
Doug G
======
Reply With Quote
  #3  
Old 26th October 2012, 04:11 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,660
linuxfirefox
Re: Writing to a file with PHP

Likely it is SELinux.

Apache is constrained to prevent security breaches if the server is penetrated. It doesn't allow for read/write outside its compartmented area.
Reply With Quote
  #4  
Old 31st October 2012, 06:53 PM
cyborg Offline
Registered User
 
Join Date: Apr 2004
Location: Brackley, England
Age: 23
Posts: 186
linuxfirefox
Re: Writing to a file with PHP

Quote:
Originally Posted by jpollard View Post
Likely it is SELinux.

Apache is constrained to prevent security breaches if the server is penetrated. It doesn't allow for read/write outside its compartmented area.
I agree, there are some Apache flags to look at:

http://upload.wikimedia.org/wikipedi...inux_admin.png
__________________
[joe@host]
Reply With Quote
Reply

Tags
file, php, writing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
read/writing Other File Sys ToFue Using Fedora 5 19th November 2008 07:38 PM
writing spec file munna_dude Servers & Networking 3 18th August 2007 10:54 AM
Device Driver Writing To File mclerand Programming & Packaging 5 4th April 2007 08:31 AM
Need help writing a DNS forward lookup zone file seguse Linux Chat 0 14th December 2006 11:38 PM
FTP: vsftpd 451 Failure writing to local file xrender Servers & Networking 3 13th July 2006 11:49 PM


Current GMT-time: 10:37 (Friday, 18-04-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat