Announcement

  •  » Engine
  •  » how does $conf['chmod_value'] work?

#1 2013-01-01 13:56:47

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

how does $conf['chmod_value'] work?

Hi rvelices,

Can you tell me how this work?

Code:

$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;

It is related to [Bugtracker] ticket 2811, but function prepare_directory doesn't use this configuration setting (for now).

Offline

 

#2 2013-01-01 14:16:21

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: how does $conf['chmod_value'] work?

not directly related but I remind a problem we had with "substr_compare"

should use
strpos(PHP_SAPI, 'apa') === 0

but perhaps it's irealevant here, I don't know which was exactly the problem

Offline

 

#3 2013-01-01 22:10:39

rvelices
Former Piwigo Team
2005-12-29
1960

Re: how does $conf['chmod_value'] work?

plg wrote:

Can you tell me how this work?

Code:

$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;

The only ugly way I found to know if the php runs under a unique user for the whole server. the SAPI names for apache as a module usually start with apache. I assume that other modes such as CGI or FastCGI automatically switch user.

Offline

 

#4 2013-01-02 00:00:20

Charles2012
Member
2012-11-04
26

Re: how does $conf['chmod_value'] work?

If PHP is running as CGI or FastCGI then files and folders are created using the username of the account. If it is Apache the files and folders are created using the username for apache hence the need for higher permission levels on files and folders.

This might vary from setup to setup. YMMV

P.S. One of the things I look for in a webhost is if they run PHP processes as the user itself or under apache assigned name.   Better security to have PHP processes run as my username where I don't have to have permissions set so high(777).  Only reason in my option to have files and folders set as 777 is due to a lack of security by the webhost. 777 permissions is very bad and opening yourself up.
Just my 5 cents worth!

Offline

 
  •  » Engine
  •  » how does $conf['chmod_value'] work?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact