multiple php.ini files

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

    multiple php.ini files


    I have some old legacy php scripts that need to run with register globals
    on.

    I would prefer not to run with register globals turned on where I don't need
    to.

    I am looking for a way of having a separate php.ini file for that directory,
    that has globals on and run with globals off for the rest of my server.

    Thanks.


  • Dave Patton

    #2
    Re: multiple php.ini files

    "Bob" <fake@dontbothe r.com> wrote in
    news:4209939c$0 $29787$c30e37c6 @lon-reader.news.tel stra.net:
    [color=blue]
    >
    > I have some old legacy php scripts that need to run with register
    > globals on.
    >
    > I would prefer not to run with register globals turned on where I
    > don't need to.
    >
    > I am looking for a way of having a separate php.ini file for that
    > directory, that has globals on and run with globals off for the rest
    > of my server.[/color]

    If using Apache, use one php.ini file, and then use a .htaccess
    file in that directory to set register_global s.

    --
    Dave Patton
    Canadian Coordinator, Degree Confluence Project

    My website: http://members.shaw.ca/davepatton/

    Comment

    • Franck Nijhof - BlueSolid Software

      #3
      Re: multiple php.ini files

      Bob wrote:[color=blue]
      > I have some old legacy php scripts that need to run with register globals
      > on.
      >
      > I would prefer not to run with register globals turned on where I don't need
      > to.
      >
      > I am looking for a way of having a separate php.ini file for that directory,
      > that has globals on and run with globals off for the rest of my server.
      >
      > Thanks.
      >
      >[/color]


      You could install suPHP (suphp.org).
      It offers the possibility to assign an
      different php.ini to each virtualhost.


      Kind regards,

      Franck Nijhof
      BlueSolid Software

      Comment

      • Chung Leong

        #4
        Re: multiple php.ini files

        "Bob" <fake@dontbothe r.com> wrote in message
        news:4209939c$0 $29787$c30e37c6 @lon-reader.news.tel stra.net...[color=blue]
        >
        > I have some old legacy php scripts that need to run with register globals
        > on.
        >
        > I would prefer not to run with register globals turned on where I don't[/color]
        need[color=blue]
        > to.
        >
        > I am looking for a way of having a separate php.ini file for that[/color]
        directory,[color=blue]
        > that has globals on and run with globals off for the rest of my server.
        >
        > Thanks.
        >[/color]

        Not something I've done before, but in Apache, I think you can override a
        PHP option on a per-directory basis using the php_value directive. According
        to the manual, register_global s is a PHP_INI_PERDIR option.


        Comment

        • Bob

          #5
          Solution: multiple php.ini files


          "Bob" <fake@dontbothe r.com> wrote in message
          news:4209939c$0 $29787$c30e37c6 @lon-reader.news.tel stra.net...[color=blue]
          >
          > I have some old legacy php scripts that need to run with register globals
          > on.
          >
          > I would prefer not to run with register globals turned on where I don't[/color]
          need[color=blue]
          > to.
          >
          > I am looking for a way of having a separate php.ini file for that[/color]
          directory,[color=blue]
          > that has globals on and run with globals off for the rest of my server.
          >
          > Thanks.
          >
          >[/color]

          The solution to this problem was

          set register_global s = Off in the php.ini file

          in the directory that had the old PHP code, that required register_global s
          to be enabled, I put a .htaccess file with

          php_flag register_global s On

          I additionally had to make sure that the httpd.conf Directory directive was
          allowed to have overrides from the .htaccess file



          Comment

          Working...