• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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