Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Администрирование Web серверов и Web служб > .htaccess и global


Автор: deMike 13.2.2006, 14:41
Добрый день, возможно ли через .htaccess выключить register_globals?

Автор: Sun 13.2.2006, 15:48
Нельзя. Это нужно делать в php.ini.

Автор: deMike 13.2.2006, 16:06
А как на хостинге тогда выключить?

Автор: Sun 13.2.2006, 16:44
Если PHP работает через CGI, то в директории с твоей php-программой ложишь файл php.ini, в котором прописываешь нужные тебе настройки. Если же PHP работает как модуль вэб-сервера, то нужно редактировать главный php.ini файл. Это уже нужно с админом этого сервера говорить.

Автор: Mal Hack 13.2.2006, 18:19
Почему нельзя.
php_value register_globals 0

Автор: Sun 13.2.2006, 18:36
Цитата(Mal Hack @ 13.2.2006, 15:19 Найти цитируемый пост)
php_value register_globals 0

В .htaccess? И что будет нормально работать? Если так то сорри за дезинформацию.

Но это наверно только в случае если php установлен как модуль Апача. Если как CGI, то придется редактировать php.ini.

Автор: Mal Hack 13.2.2006, 20:10
Цитата(Sun @ 13.2.2006, 18:36 Найти цитируемый пост)
В .htaccess? И что будет нормально работать? Если так то сорри за дезинформацию.

Да, спокойно. Не все директивы, конечно можно писать в .htaccess, для некоторых нужен php_flag, но да, можно.
При CGI работать не будет.

Вот ссылка: http://php.rinet.ru/manual/en/configuration.changes.php
Цитата
Running PHP as an Apache module

When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride Options" or "AllowOverride All" privileges to do so.

With PHP 4 and PHP 5, there are several Apache directives that allow you to change the PHP configuration from within the Apache configuration files. For a listing of which directives are PHP_INI_ALL, PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini directives appendix.

    Note: With PHP 3, there are Apache directives that correspond to each configuration setting in the php3.ini name, except the name is prefixed by "php3_".

php_value name value

    Sets the value of the specified directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a previously set value use none as the value.

        Note: Don't use php_value to set boolean values. php_flag (see below) should be used instead.

php_flag name on|off

    Used to set a boolean configuration directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives.
php_admin_value name value

    Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with php_admin_value can not be overridden by .htaccess or virtualhost directives. To clear a previously set value use none as the value.
php_admin_flag name on|off

    Used to set a boolean configuration directive. This can not be used in .htaccess files. Any directive type set with php_admin_flag can not be overridden by .htaccess or virtualhost directives.

Example 9-2. Apache configuration example

<IfModule mod_php5.c>
  php_value include_path ".:/usr/local/lib/php"
  php_admin_flag safe_mode on
</IfModule>
<IfModule mod_php4.c>
  php_value include_path ".:/usr/local/lib/php"
  php_admin_flag safe_mode on
</IfModule>
<IfModule mod_php3.c>
  php3_include_path ".:/usr/local/lib/php"
  php3_safe_mode on
</IfModule>

Автор: deMike 19.2.2006, 10:48
Спасибо.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)