php.ini settings not taking effect

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

    #1

    php.ini settings not taking effect

    I just put up php.ini-recommended as php.ini in the server-side working directory where my php
    scripts are located. The file has "magic_quotes_g pc" set to "Off", but when I test it within my php
    script using "get_magic_quot es_gpc()" I find it is set to "On". I thought all I had to do was setup
    php.ini the way I wanted it and locate it in the working directory. As it turned out, I didn't have
    to make any changes to php.ini, just renamed it from php.ini-recommended.

    Any help would be apprecited.
    Thanks,
    Don
  • Andy Hassall

    #2
    Re: php.ini settings not taking effect

    On Thu, 04 Nov 2004 16:22:40 -0700, Don <no@adr.com> wrote:
    [color=blue]
    >I just put up php.ini-recommended as php.ini in the server-side working directory where my php
    >scripts are located. The file has "magic_quotes_g pc" set to "Off", but when I test it within my php
    >script using "get_magic_quot es_gpc()" I find it is set to "On". I thought all I had to do was setup
    >php.ini the way I wanted it and locate it in the working directory. As it turned out, I didn't have
    >to make any changes to php.ini, just renamed it from php.ini-recommended.[/color]

    Use the phpinfo() function to dump configuration settings, one of the first
    lines is the location of php.ini that PHP is actually using. It sounds like
    this isn't the location you've modified.

    The PHPRC environment variable can be useful for telling PHP which directory
    to look in. The locations it looks in by default depend on your platform.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • Don

      #3
      Re: php.ini settings not taking effect

      On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <andy@andyh.co. uk> wrote:
      [color=blue]
      >On Thu, 04 Nov 2004 16:22:40 -0700, Don <no@adr.com> wrote:
      >[color=green]
      >>I just put up php.ini-recommended as php.ini in the server-side working directory where my php
      >>scripts are located. The file has "magic_quotes_g pc" set to "Off", but when I test it within my php
      >>script using "get_magic_quot es_gpc()" I find it is set to "On". I thought all I had to do was setup
      >>php.ini the way I wanted it and locate it in the working directory. As it turned out, I didn't have
      >>to make any changes to php.ini, just renamed it from php.ini-recommended.[/color]
      >
      > Use the phpinfo() function to dump configuration settings, one of the first
      >lines is the location of php.ini that PHP is actually using. It sounds like
      >this isn't the location you've modified.
      >
      > The PHPRC environment variable can be useful for telling PHP which directory
      >to look in. The locations it looks in by default depend on your platform.[/color]

      Thanks for your reply Andy. I understand what you're saying. How do I set PHPRC? I would guess I
      would do it from within my php script somehow?

      Don


      ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
      http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
      ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

      Comment

      • Steve Turnbull

        #4
        Re: php.ini settings not taking effect

        Don wrote:[color=blue]
        > On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <andy@andyh.co. uk> wrote:
        >
        >[color=green]
        >>On Thu, 04 Nov 2004 16:22:40 -0700, Don <no@adr.com> wrote:
        >>
        >>[color=darkred]
        >>>I just put up php.ini-recommended as php.ini in the server-side working directory where my php
        >>>scripts are located. The file has "magic_quotes_g pc" set to "Off", but when I test it within my php
        >>>script using "get_magic_quot es_gpc()" I find it is set to "On". I thought all I had to do was setup
        >>>php.ini the way I wanted it and locate it in the working directory. As it turned out, I didn't have
        >>>to make any changes to php.ini, just renamed it from php.ini-recommended.[/color]
        >>
        >>Use the phpinfo() function to dump configuration settings, one of the first
        >>lines is the location of php.ini that PHP is actually using. It sounds like
        >>this isn't the location you've modified.
        >>
        >>The PHPRC environment variable can be useful for telling PHP which directory
        >>to look in. The locations it looks in by default depend on your platform.[/color]
        >
        >
        > Thanks for your reply Andy. I understand what you're saying. How do I set PHPRC? I would guess I
        > would do it from within my php script somehow?
        >
        > Don
        >[/color]
        What platform are you using?

        Steve

        Comment

        • Don

          #5
          Re: php.ini settings not taking effect

          On Fri, 05 Nov 2004 09:28:46 +0000, Steve Turnbull <aufa27@dsl.pip ex.com> wrote:
          [color=blue]
          >Don wrote:[color=green]
          >> On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <andy@andyh.co. uk> wrote:
          >>
          >>[color=darkred]
          >>>On Thu, 04 Nov 2004 16:22:40 -0700, Don <no@adr.com> wrote:
          >>>
          >>>
          >>>>I just put up php.ini-recommended as php.ini in the server-side working directory where my php
          >>>>scripts are located. The file has "magic_quotes_g pc" set to "Off", but when I test it within my php
          >>>>script using "get_magic_quot es_gpc()" I find it is set to "On". I thought all I had to do was setup
          >>>>php.ini the way I wanted it and locate it in the working directory. As it turned out, I didn't have
          >>>>to make any changes to php.ini, just renamed it from php.ini-recommended.
          >>>
          >>>Use the phpinfo() function to dump configuration settings, one of the first
          >>>lines is the location of php.ini that PHP is actually using. It sounds like
          >>>this isn't the location you've modified.
          >>>
          >>>The PHPRC environment variable can be useful for telling PHP which directory
          >>>to look in. The locations it looks in by default depend on your platform.[/color]
          >>
          >>
          >> Thanks for your reply Andy. I understand what you're saying. How do I set PHPRC? I would guess I
          >> would do it from within my php script somehow?
          >>
          >> Don
          >>[/color]
          >What platform are you using?
          >
          >Steve[/color]
          Hi Steve,

          Thanks for your reply. Just did a phpinfo() and got the following:
          Apache 1.3.27
          Unix
          PHP 4.3.4

          Thanks,
          Don



          ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
          http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
          ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

          Comment

          • Polaris

            #6
            Re: php.ini settings not taking effect

            php.ini must be copied to the windowsdirector y

            "Don" <no@adr.com> schreef in bericht
            news:7ksmo0daqf g5mapkrt2koc8da mj6sh30d9@4ax.c om...[color=blue]
            > On Fri, 05 Nov 2004 09:28:46 +0000, Steve Turnbull <aufa27@dsl.pip ex.com>
            > wrote:
            >[color=green]
            >>Don wrote:[color=darkred]
            >>> On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <andy@andyh.co. uk>
            >>> wrote:
            >>>
            >>>
            >>>>On Thu, 04 Nov 2004 16:22:40 -0700, Don <no@adr.com> wrote:
            >>>>
            >>>>
            >>>>>I just put up php.ini-recommended as php.ini in the server-side working
            >>>>>director y where my php
            >>>>>scripts are located. The file has "magic_quotes_g pc" set to "Off", but
            >>>>>when I test it within my php
            >>>>>script using "get_magic_quot es_gpc()" I find it is set to "On". I
            >>>>>thought all I had to do was setup
            >>>>>php.ini the way I wanted it and locate it in the working directory. As
            >>>>>it turned out, I didn't have
            >>>>>to make any changes to php.ini, just renamed it from
            >>>>>php.ini-recommended.
            >>>>
            >>>>Use the phpinfo() function to dump configuration settings, one of the
            >>>>first
            >>>>lines is the location of php.ini that PHP is actually using. It sounds
            >>>>like
            >>>>this isn't the location you've modified.
            >>>>
            >>>>The PHPRC environment variable can be useful for telling PHP which
            >>>>directory
            >>>>to look in. The locations it looks in by default depend on your
            >>>>platform.
            >>>
            >>>
            >>> Thanks for your reply Andy. I understand what you're saying. How do I
            >>> set PHPRC? I would guess I
            >>> would do it from within my php script somehow?
            >>>
            >>> Don
            >>>[/color]
            >>What platform are you using?
            >>
            >>Steve[/color]
            > Hi Steve,
            >
            > Thanks for your reply. Just did a phpinfo() and got the following:
            > Apache 1.3.27
            > Unix
            > PHP 4.3.4
            >
            > Thanks,
            > Don
            >
            >
            >
            > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
            > News==----
            > http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000
            > Newsgroups
            > ---= East/West-Coast Server Farms - Total Privacy via Encryption =---[/color]


            Comment

            • Andy Hassall

              #7
              Re: php.ini settings not taking effect

              On Sat, 6 Nov 2004 02:35:17 +0100, "Polaris" <ask4polaris@ho tmail.com> wrote:
              [color=blue][color=green][color=darkred]
              >>>What platform are you using?[/color]
              >>
              >> Thanks for your reply. Just did a phpinfo() and got the following:
              >> Apache 1.3.27
              >> Unix
              >> PHP 4.3.4[/color]
              >
              >php.ini must be copied to the windowsdirector y[/color]

              Which sort of Unix has a Windows directory?

              Even on Windows that advice is bad, keep things out of the Windows directory.
              Either put it in one of the various places PHP looks (depending on which
              webserver you're using) or set PHPRC environment variable.

              --
              Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
              <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

              Comment

              • Andy Hassall

                #8
                Re: php.ini settings not taking effect

                On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
                [color=blue]
                >Thanks for your reply. Just did a phpinfo() and got the following:
                >Apache 1.3.27
                >Unix
                >PHP 4.3.4[/color]

                What does phpinfo() say the path it is using is?

                I tend to have php.ini in the same directory as Apache's httpd.conf, but it's
                configurable, either with PHPRC or at PHP compile time.

                --
                Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                Comment

                • Illusionistx

                  #9
                  Re: php.ini settings not taking effect

                  You did restart your server, right? I mean after you made the chanegs
                  in php.ini you wanted, they wont take affect until after you've
                  restarted Apache.

                  Comment

                  • Don

                    #10
                    Re: php.ini settings not taking effect

                    On 5 Nov 2004 21:22:17 -0800, illusionistx@gm ail.com (Illusionistx) wrote:
                    [color=blue]
                    >You did restart your server, right? I mean after you made the chanegs
                    >in php.ini you wanted, they wont take affect until after you've
                    >restarted Apache.[/color]
                    I don't have control over the server in this case, as it runs on my host's server.
                    Don


                    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

                    Comment

                    • Don

                      #11
                      Re: php.ini settings not taking effect

                      On Sat, 06 Nov 2004 02:00:00 +0000, Andy Hassall <andy@andyh.co. uk> wrote:
                      [color=blue]
                      >On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
                      >[color=green]
                      >>Thanks for your reply. Just did a phpinfo() and got the following:
                      >>Apache 1.3.27
                      >>Unix
                      >>PHP 4.3.4[/color]
                      >
                      > What does phpinfo() say the path it is using is?
                      >
                      > I tend to have php.ini in the same directory as Apache's httpd.conf, but it's
                      >configurable , either with PHPRC or at PHP compile time.[/color]

                      phpinfo():
                      Apache 1.3.27
                      Unix
                      PHP 4.3.4
                      Using php.ini at: /usr/local/lib/php.ini

                      Is that /usr/local/lib/php.ini a directory that I have access to? If so, how do I access it? I
                      don't have control over Apache's httpd.conf, as I'm running my php scripts on my ISP server. I have
                      a ticket into them to find out why their PHP apparently isn't looking in my working directory on
                      their server (where my php scripts are) for my php.ini. However, I think I read that one can tell
                      PHP the location of the php.ini file to use via the PHPRC environment variable. I at a loss on this
                      one. Sure could use some help.

                      Thanks,
                      Don



                      ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                      http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                      ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

                      Comment

                      • Andy Hassall

                        #12
                        Re: php.ini settings not taking effect

                        On Fri, 05 Nov 2004 23:30:46 -0700, Don <no@adr.com> wrote:
                        [color=blue]
                        >On Sat, 06 Nov 2004 02:00:00 +0000, Andy Hassall <andy@andyh.co. uk> wrote:
                        >[color=green]
                        >>On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
                        >>[color=darkred]
                        >>>Thanks for your reply. Just did a phpinfo() and got the following:
                        >>>Apache 1.3.27
                        >>>Unix
                        >>>PHP 4.3.4[/color]
                        >>
                        >> What does phpinfo() say the path it is using is?
                        >>
                        >> I tend to have php.ini in the same directory as Apache's httpd.conf, but it's
                        >>configurabl e, either with PHPRC or at PHP compile time.[/color]
                        >
                        >phpinfo():
                        >Apache 1.3.27
                        >Unix
                        >PHP 4.3.4
                        >Using php.ini at: /usr/local/lib/php.ini
                        >
                        >Is that /usr/local/lib/php.ini a directory that I have access to? If so, how do I access it? I
                        >don't have control over Apache's httpd.conf, as I'm running my php scripts on my ISP server.[/color]

                        That would have been a useful bit of information to post earlier - since you
                        asked why your changes to php.ini aren't being picked up, it gives the
                        impression you control the server in the first place...
                        [color=blue]
                        > I have
                        >a ticket into them to find out why their PHP apparently isn't looking in my working directory on
                        >their server (where my php scripts are) for my php.ini.[/color]

                        It shouldn't do. PHP configuration, at least for the Apache module version
                        (another assumption - running as a module is the most common configuration) is
                        only read when Apache starts. Even if you could change php.ini at runtime,
                        which if you're just a user you can't, then it wouldn't make any difference
                        because PHP doesn't even read it until next startup.

                        Even that assumption might be inaccurate; you could be running PHP as CGI,
                        which is slower, but there's then the opportunity to point it at your own
                        php.ini file through $PHPRC or a command-line switch in the #! line at the top
                        of the script.
                        [color=blue]
                        > However, I think I read that one can tell
                        >PHP the location of the php.ini file to use via the PHPRC environment variable. I at a loss on this
                        >one. Sure could use some help.[/color]

                        I'm trying to help but you've not given enough information, and the
                        situation's changed now you've said you're a user on somebody else's server,
                        rather than setting up your own.

                        Take a step back - you've been asking how to change php.ini - this is almost
                        certainly the wrong approach. Your ISP is not going to change something
                        server-wide just for your benefit, it'll break other people's scripts.

                        You mentioned in the original post that what you were actually trying to do is
                        turn off magic_quotes_gp c.

                        There are several places to alter PHP configuration settings:

                        (1) Server-wide in php.ini. Only read at startup. Only the administrator can
                        change it.

                        (2) At runtime, with ini_set(). Only works for a subset of options.
                        magic_quotes_gp c is not one of them. See the manual for the list.

                        (3) In an Apache .htaccess file. Depends on your configuration. You can change
                        more settings here than you can with ini_set(), but not all of them. You _can_
                        change magic_quotes_gp c.

                        And of course, read the manual: http://www.php.net/manual/en/configuration.php
                        Each of these options is explained there.

                        --
                        Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                        <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                        Comment

                        • Warren Oates

                          #13
                          Re: php.ini settings not taking effect

                          In article <3qboo0pt4f08mu u8phv8bcpqve8in 7e9ka@4ax.com>,
                          Andy Hassall <andy@andyh.co. uk> wrote:

                          :Which sort of Unix has a Windows directory?

                          Red Hat 6 running Gnome
                          OS X 10.1
                          --
                          Looks like more of Texas to me.
                          .... Arizona, where the nights are warm and the roads are straight.

                          Comment

                          • Andy Hassall

                            #14
                            Re: php.ini settings not taking effect

                            On Sat, 06 Nov 2004 07:47:18 -0500, Warren Oates <Warren.Oates@G mail.com>
                            wrote:
                            [color=blue]
                            >:Which sort of Unix has a Windows directory?
                            >
                            >Red Hat 6 running Gnome
                            >OS X 10.1[/color]

                            andyh@server:~$ mkdir Windows

                            OK, fair enough. Which sort of Unix has a Windows directory that PHP by
                            default looks for its php.ini file in, then? :-p

                            --
                            Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                            <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                            Comment

                            Working...