Bug 1262481 - error mkdir from php
Summary: error mkdir from php
Keywords:
Status: CLOSED EOL
Alias: None
Product: GlusterFS
Classification: Community
Component: scripts
Version: 3.5.2
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-11 20:40 UTC by Thomas
Modified: 2016-06-17 15:57 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-17 15:57:47 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Thomas 2015-09-11 20:40:23 UTC
Description of problem:

PHP 5.6.1 can not create dir on glusterfs mount

Version-Release number of selected component (if applicable):


How reproducible:

create a web site on glusterfs mount and call php script that tries to create a dir



Steps to Reproduce:
1. create a php file

<?php
$outdir = 'testdir';
mkdir($outdir, 0777, true);

if(is_dir($outdir) == true) {
   echo "found";
}
else {
   echo "not fond";
}
?>

2. put that on clusterfs mout

3. open it via apache http://


Actual results:

testdir does not exist

Expected results:

testdir should exist

Additional info:

tested with apache 2.4.10 and php 5.6.1

Comment 1 Niels de Vos 2015-09-15 12:30:03 UTC
Could you confirm that you made the directory where this PHP script is writing, is writeable by the Apache user?

You could try to "chmod ugo+rwx /path/to/mountpoint/parent/of/php/dir".

Also check if this is not blocked by SElinux or other security frameworks.

Comment 2 Thomas 2015-09-15 13:27:01 UTC
Apache has full write access there are absolutely (100%) no restrictions.

This php code works perfect (but uses system calls):

system("mkdir testdir");
$d = dir(".");
while(($etg = $d->read()) !== false) {
   echo htmlspecialchars($etg) . "<br />";
}
$d->close();
system("rmdir testdir");

I think this is related with the way php is creating a file or directory.

BTW - same problem with creating and removing files.

Comment 3 Niels de Vos 2015-09-15 13:34:39 UTC
Could you post the output of "ls -ld /parent/dir/where/php/creates/a/dir" and the error messages that the script gets or logs somewhere?

Comment 4 Thomas 2015-09-15 14:06:37 UTC
ww1:/ # ls -ld /_www
drwxrwxrwx 16 wwwrun users 4096 Sep 11 22:43 /_www
ww1:/ # ls -ld /_www/www.e4e.at/
drwxrwxrwx 2 wwwrun users 87 Sep 11 23:14 /_www/www.e4e.at/

ww1:/_www/www.e4e.at # l
total 8
drwxrwxrwx  2 wwwrun users   87 Sep 11 23:14 ./
drwxrwxrwx 16 wwwrun users 4096 Sep 11 22:43 ../
-rw-rw-rw-  1 wwwrun users 1035 Sep 11 21:08 _index.html
-rw-rw-rw-  1 wwwrun users  212 Sep 11 22:43 index.php
-rw-rw-rw-  1 wwwrun users   64 Sep 11 21:07 robots.txt
-rw-rw-rw-  1 wwwrun users  183 Sep 11 23:14 test.php
-rw-rw-r--  1 wwwrun users  173 Sep 11 23:09 test.txt

ww1:/_www/www.e4e.at # cat index.php
<?php

$outdir = 'tom';
mkdir($outdir, 775, true);

if(is_dir($outdir) == true){
   echo "gefunden";
}

Comment 5 Vijay Bellur 2015-09-22 12:24:45 UTC
Can you please try mounting glusterfs with enable-ino32 and check if the problem persists? thanks.

Comment 6 Thomas 2015-09-22 14:45:25 UTC
 gluster volume set gv0 nfs.enable-ino32 on

does not help, still the same problem php can not create directory

Comment 7 Vijay Bellur 2015-09-22 19:03:14 UTC
Can you please try mounting your volume as

mount -t glusterfs -o enable-ino32 ... 

and check again? thanks.

Comment 8 Thomas 2015-09-22 22:57:29 UTC
Yes, this is much better now. php can create directories now


Altough php still can't read directories

<?php
echo "-----------<br />";
echo "read dir<br />";
echo "-----------<br />";

$d = dir(".");
while (($eintrag = $d->read()) !== false) {
   echo htmlspecialchars($eintrag) . "<br />";
}
$d->close();
?>

ist not working on glusterfs vol but reads on ext4 vol

same code, same server, two virtualhosts in apache, one rootdoc on glusterfs the other on ext4

Comment 9 Vijay Bellur 2015-09-23 08:33:06 UTC
What is the filesystem that you are using for gluster bricks? If it is ext4, can you please try if readdir works fine with a xfs based gluster brick? Thanks.

Comment 10 Niels de Vos 2016-06-17 15:57:47 UTC
This bug is getting closed because the 3.5 is marked End-Of-Life. There will be no further updates to this version. Please open a new bug against a version that still receives bugfixes if you are still facing this issue in a more current release.


Note You need to log in before you can comment on or make changes to this bug.