• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

CentOS 6.2 - Plesk 10.44 - PHP5 Write Permissions

RaymondR

New Pleskian
CentOS 6.2 - Plesk 10.44 - PHP5.3.3 Write Permissions

OSLinux 2.6.32-220.17.1.el6.x86_64
Panel version 10.4.4 Update #41
PHP Version 5.3.3

I have the following problem;

I manage serveral servers all running CentOS 6.2 and Plesk 10.

All are clean installs with plesk install after that.

Everytime I run in to the problem PHP scripts have no write permissions to certain directories. At this moment I don't know after witch update, I don't manage to get PHP scripts writing to directories at all.

I have a drupal 7 wich worked before and now saying:

sites/default/files not writable
tmp not writable

I tried all kind of things with a testsite;

i created testen.domain.com within that i created a folder "testen".

I made a file "schrijftest.php" with the following content;

Code:
<?php 
echo `whoami` . '<BR>';
$filename = 'test.txt';
$Content = "Add this to the file\r\n";
$handle = fopen($filename, 'x+');
fwrite($handle, $Content);
fclose($handle);
?>

I set the rights at this moment as following (default user /group and 777 to test);
Code:
[root@hosting4 testen]# ls -al
totaal 12
drwxrwxrwx. 2 siteuser psacln  4096 aug 13 16:39 .
drwxr-x---. 8 siteuser psaserv 4096 aug 13 16:38 ..
-rwxrwxrwx. 1 siteuser psacln   177 aug 13 16:41 schrijftest.php

Following error arises:
Code:
 [Mon Aug 13 16:39:44 2012] [error] [client x.x.x.x] PHP Warning: fopen(test.txt): failed to open stream: Permission denied in /var/www/vhosts/domain.com/testen/testen/schrijftest.php on line 5

The
Code:
echo `whoami` . '<BR>';
tells me the script is running as apache user.

Lets test what happens when chown the dir files to user apache:

Code:
[root@hosting4 testen]# ls -al
totaal 12
drwxrwxrwx. 2 apache  apache  4096 aug 13 16:39 .
drwxr-x---. 8 siteuser psaserv 4096 aug 13 16:38 ..
-rwxrwxrwx. 1 apache  apache   177 aug 13 16:41 schrijftest.php

I get no PHP warning anymore but no file is created....

How can I get this to work and why did this stop working???? I tried allso all kind of things like disableing safe mode etc...
 
Last edited:
Summary: I would like to now the answer for the following question;

Witch settings do I have to use to let a certain script phpfile.php to write files in a certain folder when using php as a apache module on CentOS 6.2, Parallels panel 10.44 and PHP 5.3.3.

Raymond!
 
Is there nobody who can explain this to me? I believe it does'nt have to be difficult to get to what i want to reach. About any modern webapplication have to be able to write something in a certain directory so how are others doing this???
 
Sorry i didnt see your thread on time ...But yes, SELINUX is usually the main cause of such issues. The other common problem that is caused by it Horde failing to LOGIN, some times the server failing to boot or if it boots the file system is all locked up and un-writable ...
 
Back
Top