關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 無法存取 php.ini 下更改其設定值

    Posted on May 20th, 2007 Sam Tang 3 comments

    php.ini 內有很多設定值,如果無法更法 php.ini 而需要更改某些設定值的話,可以透過 PHP 程式或 .htaccess 來實現。

    PHP

    PHP:
    1. <? ini_set("magic_quotes_gpc", "1"); ?>

    以上程式碼會開啟 magic_quotes_gpc。

    .htaccess
    用 .htaccess 來實現更加方便,因為整個目錄內也會生效,在 .htaccess 加入:

    php_value magic_quotes_gpc 1

    以上使用了 php_value 來設定 magic_quotes_gpc,並定義它的值為 1 (即開啟)。

    這個方法是有限制的,例如 safe_mode 及 safe_mode_exec_dir 這類 functions 就不可以修改了。


     

    3 responses to “無法存取 php.ini 下更改其設定值”

    1. It seems that you are wrong :(

      Name Default Changeable
      magic_quotes_gpc “1″ PHP_INI_PERDIR

      PHP_INI_PERDIR:Entry can be set in php.ini, .htaccess or httpd.conf

      From: http://cn.php.net/manual/en/ini.php#ini.list

    2. 我之前報讀過PHP課程 , 但始終還是很多不明

      而且只教了 12 小時的入門課程。

      如果你有興趣私人教授 , 希望能add 我的 msn 開價

      xylonchan@gmail.com

      我真的很想學會寫程式 , 開發自己的網站。希望你能聯絡我

    3. 那麼如果想開啟 mb_substr() 功能,應該怎麼寫呢?

    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word