Пример использования PHP функции chmod

Система управления правами доступа к файлам с использованием PHP функции chmod

Данный скрипт написан на языке PHP. Он и файлы примеров созданы специально для того, чтобы вы могли потренироваться с установкой прав доступа к файлам (атрибутов), в Unix-подобных операционных системах. Надеюсь, он убедительно показывает преимущество десятичного числового представления атрибутов беред любым другим (представьте, если бы вам приходилось щелкать по девяти чекбоксам прав доступа для каждого файла в каталоге. И ведь это еще небольшое количество файлов!).

Установка прав доступа производится PHP функции chmod, а считывание, PHP функцией fileperms – все, как описано на странице  PHP chmod – установка и чтение прав доступа.

Если вы установите атрибуты правильно, то сможете смотреть содержимое HTML-файлов и запускать PHP-скрипты. Неправильные права доступа приведут к  ошибкам http сервера. Эти ошибки не срашны для сайта и вы можете спокойно экспериментировать. Однако, всвязи с ростущей популярностью сайта вероятны ситуации когда несколько человек одновременно будут пытаться изменить права доступа к тестовым файлам и это может привести к то му что вы увидите не театрибуты, которые устанавливали. Есть только один способ избавится от подобных помех – не балуйтесь слишком долго ;-)

Вы можете менять атрибуты (права доступа) этих файлов без какого-либо ущерба для сайта. Они размещены здесь специально для демонстрации возможностей PHP chmod:

 


Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/users/s/supervisork/domains/webdesign.site3k.ru/consulting/php_chmod.php on line 76
ИмяТипДатаАтрибут
attrib.phpфайл php10.8.2014 17:03:34
chmod.htmlфайл html10.8.2014 17:03:35
chmod.phpфайл php10.8.2014 17:03:35
file_perms.phpфайл php10.8.2014 17:03:35
fileperms.phpфайл php10.8.2014 17:03:36
permision.phpфайл php10.8.2014 17:03:36
php.htmlфайл html10.8.2014 17:03:36
php.phpфайл php10.8.2014 17:03:36
php_chmod.htmlфайл html10.8.2014 17:03:37
php_chmod.phpфайл php10.8.2014 17:03:37

 

 

 


На главную страницу сайта