Using local php.ini files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chuck Anderson

    Using local php.ini files

    My Web Host (Linux - Apache) recently upgraded to Php5. One thing lost
    in the upgrade was a global configuration that allowed me to place
    php.ini files in any directory and they would be read and used (I don't
    know if that was in addition to a global php.ini file or not).

    Prior to that (a couple of years ago) php directives were placed in the
    htaccess file in the site's root directory, but after an even earlier
    upgrade the htaccess directives gave a 500 Server Error. That is when I
    was started using local php.ini files instead.

    Now I can do neither. The local php.ini files are no longer used and
    adding php directives to htaccess causes a 500 Server error.

    The directive I am most concerned with is include_path, so I can keep
    include files outside of the web site.

    I have communicated with my web host a few times about this and they
    seem to have no idea what needs to be done. I know, this is pretty
    shoddy on their part, but in all other things this host has been very
    good, so I'd rather stick with them.

    Does anyone have any idea what kind of configuration they used that
    allowed the local php ini files to be used?

    Is there an Apache configuration directive needed to allow php
    directives in the htaccess file?

    Thanks for any pointers.

    --
    *************** **************
    Chuck Anderson • Boulder, CO
    *************** **************
  • J.J.SOLARI

    #2
    Re: Using local php.ini files

    Chuck Anderson <websiteaddress @seemy.sigwrote :
    Does anyone have any idea what kind of configuration they used that
    allowed the local php ini files to be used?
    >
    Is there an Apache configuration directive needed to allow php
    directives in the htaccess file?
    Chuck,

    If PHP is running as a CGI, you could use the special environment
    variable PHPRC (see <http://www.php.net/manual/en/configuration.p hp>)

    In your htaccess file, you would then have:

    SetEnv PHPRC /path/to/your/php.ini

    hih,

    JJS.

    Comment

    • Chuck Anderson

      #3
      Re: Using local php.ini files

      J.J.SOLARI wrote:
      Chuck Anderson <websiteaddress @seemy.sigwrote :
      >
      >
      >Does anyone have any idea what kind of configuration they used that
      >allowed the local php ini files to be used?
      >>
      >Is there an Apache configuration directive needed to allow php
      >directives in the htaccess file?
      >>
      >
      Chuck,
      >
      If PHP is running as a CGI, you could use the special environment
      variable PHPRC (see <http://www.php.net/manual/en/configuration.p hp>)
      >
      In your htaccess file, you would then have:
      >
      SetEnv PHPRC /path/to/your/php.ini
      >
      hih,
      >
      JJS.
      >
      Thanks. Php is running as a cgi at my web host, so I tried what you
      said, ... but no luck. I cannot set the Environment variable PHPRC.

      I wonder if permission has to be granted in httpd.conf.

      (Note: while researching this I found that you should specify the path
      to the directory php.ini is in, not to the file itself. i.e.,
      /path/to/your/phpinidirectory )

      --
      *************** **************
      Chuck Anderson • Boulder, CO

      Everyone's journey should be different,
      so that we all are enriched
      in new and endless ways
      *************** **************

      Comment

      • J.J.SOLARI

        #4
        Re: Using local php.ini files

        Chuck Anderson <websiteaddress @seemy.sigwrote :

        In your htaccess file, you would then have:

        SetEnv PHPRC /path/to/your/php.ini

        hih,

        JJS.
        >
        Thanks. Php is running as a cgi at my web host, so I tried what you
        said, ... but no luck. I cannot set the Environment variable PHPRC.
        >
        I wonder if permission has to be granted in httpd.conf.
        >
        (Note: while researching this I found that you should specify the path
        to the directory php.ini is in, not to the file itself. i.e.,
        /path/to/your/phpinidirectory )
        Chuck,

        Indeed, my mistake :(

        Also, I forgot to put quotes around ; so, it should read:

        SetEnv PHPRC "/path/to/your_php.ini/directory/"

        Note that this path is not taken from the server root, but from the
        filesystem root (check with phpinfo).

        hope it will work this time,

        JJS.

        Comment

        • Chuck Anderson

          #5
          Re: Using local php.ini files

          J.J.SOLARI wrote:
          Chuck Anderson <websiteaddress @seemy.sigwrote :
          >
          >
          >
          >>In your htaccess file, you would then have:
          >>>
          >>SetEnv PHPRC /path/to/your/php.ini
          >>>
          >>hih,
          >>>
          >>JJS.
          >>>
          >>>
          >Thanks. Php is running as a cgi at my web host, so I tried what you
          >said, ... but no luck. I cannot set the Environment variable PHPRC.
          >>
          >I wonder if permission has to be granted in httpd.conf.
          >>
          >(Note: while researching this I found that you should specify the path
          >to the directory php.ini is in, not to the file itself. i.e.,
          >/path/to/your/phpinidirectory )
          >>
          >
          Chuck,
          >
          Indeed, my mistake :(
          >
          Also, I forgot to put quotes around ; so, it should read:
          >
          SetEnv PHPRC "/path/to/your_php.ini/directory/"
          >
          Note that this path is not taken from the server root, but from the
          filesystem root (check with phpinfo).
          >
          hope it will work this time,
          >
          JJS.
          >
          Thanks again, but I already tried several formats (quotes, no quotes,
          trailing slash, no trailing slash, ...). I think something is not
          allowing me to set that (or Php was compiled to ignore it?).

          --
          *************** **************
          Chuck Anderson • Boulder, CO

          Everyone's journey should be different,
          so that we all are enriched
          in new and endless ways
          *************** **************

          Comment

          Working...