You get a bonus - 1 coin for daily activity. Now you have 1 coin

Ubuntu - apache mkdir php 775

Practice




ubuntu - apache mkdir php 775 how do I make a folder get created with these permissions?


I figured it out
in the file /etc/apache2/envvars :
add
umask 002



/home/user/.profile umask
/etc/profile
/etc/login.defs
find, set, and uncomment umask 002

check what the current umask is, just run umask, to set it run umask 002

restart Apache :

/etc/init.d/apache2 stop
/etc/init.d/apache2 start


for older ones change it like this
find /home/user -type f -exec chmod 600 {} ;
find all objects of type file (f) in /home/user and run chmod 600 on them.

Or for directories:

find /home/user -type d -exec chmod 700 {} ;


and test it
echo 'makedir';
var_dump(m kdir("test", 0777));

echo 'create file';


$file = fo pen ( "testpermition.php", 'w' );
fw rite ( $file, "test " );
fclo se ( $file );

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)