Jump to content

Recommended Posts

I'm trying to get an open source PHP app working for my company.  It's giving me the following custom error:

 

FreeMED was unable to create a file to record the healthy status of the system.
The FreeMED directory should be owned by the user that the webserver is running as...
Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED.
But that is not advisable from a security standpoint. 

 

I've narrowed it down to the line of PHP that's breaking it here:

 

$test = CreateObject('FreeMED.FreeMEDSelfTest');

 

As far as I can tell, I've made the directory it's using as open as possible and it's still giving me that error.  The owner is apache (user and group) and the permissions are (temporarily) set at 0777 (universal read/write).

 

Is there some PHP or Apache configuration that needs changed to allow PHP this kind of permission?

Link to comment
https://forums.phpfreaks.com/topic/70653-file-write-permissions/
Share on other sites

Update, created a test.php:

 

<?php

$filename = "testFile.txt";
$filehandler = fopen($filename, 'w') or die ("blowed up<br>");
fclose($filehandler);

?>

 

Gives me this:

 

Warning: fopen(testFile.txt): failed to open stream: Permission denied in /usr/share/freemed-0.8.4/test.php on line 16
blowed up

 

It's certainly not FreeMED's fault.  My PHP scripts just don't have write permission for the directory they're in, but I don't know why.

Yah, I checked that.  It's not.

 

It occurred to me that maybe a firewall was blocking something, but then that doesn't make much since as PHP is all server side.  So the server just sees apache as trying to create the file, which it should be able to as the owner of the directory and the permissions wide open.  So it's not that.

 

So...yeah.  ???

Upgraded to php5.  Still the same problems.  I guess it's not a PHP problem.  I'm completely at a loss, at the point of scraping the open source application and building from scratch.  But this will continue to pose a problem for any future PHP work we try to do on that server.  So frustrating...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.