470,815 Members | 1,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

php.ini settings not taking effect

Don
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_gpc" set to "Off", but when I test it within my php
script using "get_magic_quotes_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
Jul 17 '05 #1
13 10918
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_gpc" set to "Off", but when I test it within my php
script using "get_magic_quotes_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.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Don
On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <an**@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 directory where my php
scripts are located. The file has "magic_quotes_gpc" set to "Off", but when I test it within my php
script using "get_magic_quotes_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
----== 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 =---
Jul 17 '05 #3
Don wrote:
On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <an**@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 directory where my php
scripts are located. The file has "magic_quotes_gpc" set to "Off", but when I test it within my php
script using "get_magic_quotes_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

What platform are you using?

Steve
Jul 17 '05 #4
Don
On Fri, 05 Nov 2004 09:28:46 +0000, Steve Turnbull <au****@dsl.pipex.com> wrote:
Don wrote:
On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <an**@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 directory where my php
scripts are located. The file has "magic_quotes_gpc" set to "Off", but when I test it within my php
script using "get_magic_quotes_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

What platform are you using?

Steve

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 =---
Jul 17 '05 #5
php.ini must be copied to the windowsdirectory

"Don" <no@adr.com> schreef in bericht
news:7k********************************@4ax.com...
On Fri, 05 Nov 2004 09:28:46 +0000, Steve Turnbull <au****@dsl.pipex.com>
wrote:
Don wrote:
On Fri, 05 Nov 2004 00:08:36 +0000, Andy Hassall <an**@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
>directory where my php
>scripts are located. The file has "magic_quotes_gpc" set to "Off", but
>when I test it within my php
>script using "get_magic_quotes_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

What platform are you using?

Steve

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 =---

Jul 17 '05 #6
On Sat, 6 Nov 2004 02:35:17 +0100, "Polaris" <as*********@hotmail.com> wrote:
What platform are you using?


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


php.ini must be copied to the windowsdirectory


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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #7
On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
Thanks for your reply. Just did a phpinfo() and got the following:
Apache 1.3.27
Unix
PHP 4.3.4


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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #8
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.
Jul 17 '05 #9
Don
On 5 Nov 2004 21:22:17 -0800, il**********@gmail.com (Illusionistx) wrote:
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.

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 =---
Jul 17 '05 #10
Don
On Sat, 06 Nov 2004 02:00:00 +0000, Andy Hassall <an**@andyh.co.uk> wrote:
On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
Thanks for your reply. Just did a phpinfo() and got the following:
Apache 1.3.27
Unix
PHP 4.3.4


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.


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 =---
Jul 17 '05 #11
On Fri, 05 Nov 2004 23:30:46 -0700, Don <no@adr.com> wrote:
On Sat, 06 Nov 2004 02:00:00 +0000, Andy Hassall <an**@andyh.co.uk> wrote:
On Fri, 05 Nov 2004 05:33:09 -0700, Don <no@adr.com> wrote:
Thanks for your reply. Just did a phpinfo() and got the following:
Apache 1.3.27
Unix
PHP 4.3.4
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.


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.


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...
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.
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.
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.


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_gpc.

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_gpc 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_gpc.

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

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #12
In article <3q********************************@4ax.com>,
Andy Hassall <an**@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.
Jul 17 '05 #13
On Sat, 06 Nov 2004 07:47:18 -0500, Warren Oates <Wa**********@Gmail.com>
wrote:
:Which sort of Unix has a Windows directory?

Red Hat 6 running Gnome
OS X 10.1


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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ryan McLean | last post: by
reply views Thread by christopher_gedemer | last post: by
3 posts views Thread by tshad | last post: by
3 posts views Thread by =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.