FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Figure out path to php.ini
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Figure out path to php.ini [message #173401] Fri, 08 April 2011 15:50 Go to next message
Mike is currently offline  Mike
Messages: 18
Registered: December 2010
Karma: 0
Junior Member
How can a php script figure out the path to the php.ini file WITHOUT
phpinfo() enabled?

Mike
Re: Figure out path to php.ini [message #173402 is a reply to message #173401] Fri, 08 April 2011 16:06 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/8/2011 11:50 AM, Mike wrote:
> How can a php script figure out the path to the php.ini file WITHOUT
> phpinfo() enabled?
>
> Mike

phpinfo() is NEVER "disabled" - it's always available.

However, it just aggregates data from various system and PHP variables.
Check out

http://us3.php.net/manual/en/function.get-cfg-var.php

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Figure out path to php.ini [message #173403 is a reply to message #173401] Fri, 08 April 2011 16:07 Go to previous messageGo to next message
James Carlock is currently offline  James Carlock
Messages: 3
Registered: April 2011
Karma: 0
Junior Member
"Mike" <mpearl1 .at. gmail dot com> wrote:
: How can a php script figure out the path to the php.ini
: file WITHOUT phpinfo() enabled?
:
: Mike

Hi Mike,

Why do you want to know the path to PHP.INI? On a Windows
system, the path follows the following paths and if it does
NOT exist in the following paths, then you need a way to
point to the PHP.INI file.

..;%PATH%

Then Windows checks to see if the extension (.ini) gets
opened via the %PATHEXT% variable, then Windows checks to
validate if the extension (.ini) gets opened by any other
application via one or more keys in the registry.

You can use regedt32.exe to validate which application (or
program) opens the .ini extension by looking in this key:

HKEY_CLASSES_ROOT

The HKCR key does nothing more than providing a way for a
default application (program) to open files with such an
extension. Many times people use NOTEPAD.EXE to open the
file, so just because a default application exists, does
not mean that the application EXECUTES the file opened.
NOTEPAD just reads the file and presents the text it finds
in it without trying to process any of the information as
anything but text.

The list goes on and it's been a while since I pursued
this topic. So let me know if this helps at all. I do
not know about the ways LINUX searches for the .ini file,
so I shall continue to watch this topic to see if others
add anything.

Thanks.

--
Jim Carlock
http://www.facebook.com/jim.carlock
Re: Figure out path to php.ini [message #173404 is a reply to message #173402] Fri, 08 April 2011 16:13 Go to previous messageGo to next message
Helmut Chang is currently offline  Helmut Chang
Messages: 22
Registered: September 2010
Karma: 0
Junior Member
Am 08.04.2011 18:06, schrieb Jerry Stuckle:

> phpinfo() is NEVER "disabled" - it's always available.

<http://php.net/manual/en/ini.core.php#ini.disable-functions>

Helmut
Re: Figure out path to php.ini [message #173409 is a reply to message #173404] Fri, 08 April 2011 17:57 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/8/2011 12:13 PM, Helmut Chang wrote:
> Am 08.04.2011 18:06, schrieb Jerry Stuckle:
>
>> phpinfo() is NEVER "disabled" - it's always available.
>
> <http://php.net/manual/en/ini.core.php#ini.disable-functions>
>
> Helmut

I'm not saying it isn't possible. But how many hosting companies
disable it?

Pretty pointless, really, since all the information is available.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Figure out path to php.ini [message #173479 is a reply to message #173401] Fri, 15 April 2011 09:13 Go to previous messageGo to next message
Jo Schulze is currently offline  Jo Schulze
Messages: 15
Registered: January 2011
Karma: 0
Junior Member
Mike wrote:

> How can a php script figure out the path to the php.ini file WITHOUT
> phpinfo() enabled?

The predefined const PHP_CONFIG_FILE_PATH should contain the directory
where php.ini is located.
Re: Figure out path to php.ini [message #173490 is a reply to message #173479] Fri, 15 April 2011 19:49 Go to previous messageGo to next message
Twayne is currently offline  Twayne
Messages: 135
Registered: September 2010
Karma: 0
Senior Member
In news:4da80cac$0$6885$9b4e6d93(at)newsspool2(dot)arcor-online(dot)net,
Jo Schulze <antispam(at)feuersee(dot)de> typed:
> Mike wrote:
>
>> How can a php script figure out the path to the php.ini
>> file WITHOUT phpinfo() enabled?

PHPinfo() Enabled? Phpinfo is nothing but a list of all the settings on the
server for the various components you may use. phpinfo is a constant and
doesn't change on a per server basis even if they upgrade php. It's simply a
command if you will, to get that list and only needs to be done very, very
infrequently.

>
> The predefined const PHP_CONFIG_FILE_PATH should contain
> the directory where php.ini is located.

True, but to a newbie it could get confusing with all the php.ini files
strewn around his hard drive. They aren't all the same, where a phpinfo on
the server gets you the exact information you need. Also, if it's a turnkey
freebie like there are so many of these days, it wll be pretty well spelled
out n the docs that accompany it.
BTW, I haven't seen any yet that provide the right security settings for
either being a server to the outside world or just for testiing, etc. etc..
They leave that up to the user since there are so many different ways to do
it. Keep in mind I've only looked at the freebies that allow easy setup for
local server capability. Testing of code in other words.

HTH,

Twayne`
H,

Twayne`
Re: Figure out path to php.ini [message #173498 is a reply to message #173490] Fri, 15 April 2011 21:24 Go to previous messageGo to next message
Jo Schulze is currently offline  Jo Schulze
Messages: 15
Registered: January 2011
Karma: 0
Junior Member
Twayne wrote:

> In news:4da80cac$0$6885$9b4e6d93(at)newsspool2(dot)arcor-online(dot)net,
> Jo Schulze <antispam(at)feuersee(dot)de> typed:

>> The predefined const PHP_CONFIG_FILE_PATH should contain
>> the directory where php.ini is located.
>
> True, but to a newbie it could get confusing with all the php.ini
> files strewn around his hard drive. They aren't all the same, where a
> phpinfo on the server gets you the exact information you need.

I beg you pardon but if you have a bunch of php.ini files strewn around
your hard drive, you have a probem. There should be one php.ini for
every SAPI avali, which limits the number to a max of 3 (CLI, webserver
module and websever CGI). Well, thinking of it, possibly several
webservers are running at different ports, but for a productive
environment I say that you'll have a limit of 2 (CLI and whatever for
HTTP access).

> Also,
> if it's a turnkey freebie like there are so many of these days, it wll
> be pretty well spelled out n the docs that accompany it.

Huh?

> BTW, I haven't seen any yet that provide the right security
> settings for
> either being a server to the outside world or just for testiing, etc.
> etc.. They leave that up to the user since there are so many different
> ways to do it. Keep in mind I've only looked at the freebies that
> allow easy setup for local server capability. Testing of code in other
> words.

There is pretty much documentation about how to secure PHP
installations, if that was your question.
Re: Figure out path to php.ini [message #173510 is a reply to message #173498] Sat, 16 April 2011 16:41 Go to previous messageGo to next message
Twayne is currently offline  Twayne
Messages: 135
Registered: September 2010
Karma: 0
Senior Member
In news:4da8b7f7$0$6876$9b4e6d93(at)newsspool2(dot)arcor-online(dot)net,
Jo Schulze <antispam(at)feuersee(dot)de> typed:
> Twayne wrote:
>
>> In
>> news:4da80cac$0$6885$9b4e6d93(at)newsspool2(dot)arcor-online(dot)net,
>> Jo Schulze <antispam(at)feuersee(dot)de> typed:
>
>>> The predefined const PHP_CONFIG_FILE_PATH should contain
>>> the directory where php.ini is located.
>>
>> True, but to a newbie it could get confusing with all
>> the php.ini files strewn around his hard drive. They
>> aren't all the same, where a phpinfo on the server gets
>> you the exact information you need.
>
> I beg you pardon but if you have a bunch of php.ini files
> strewn around your hard drive, you have a probem. There
> should be one php.ini for every SAPI avali, which limits
> the number to a max of 3 (CLI, webserver module and
> websever CGI). Well, thinking of it, possibly several
> webservers are running at different ports, but for a
> productive environment I say that you'll have a limit of
> 2 (CLI and whatever for HTTP access).

There's one for local server, others for remote serving, a "bible" of
important parts, etc.. It's not unusual and occurs on many of them. I'm not
going back to see what each one is for, but it's all clearly documented. A
newbie however, discovering he needs to work on php.ini can pretty easily
get confused if he's the sort, as many are, who won't RTFM.
So, no, I do not have a problem; you do, in that you think you can paint
the whole world in one color. Don't not woik dat way.

>
>> Also,
>> if it's a turnkey freebie like there are so many of
>> these days, it wll be pretty well spelled out n the docs
>> that accompany it.
>
> Huh?

if it's a turnkey freebie like there are so many of
these days, it wll be pretty well spelled out n the docs
that accompany it.
Hard of reading/hearing?



>
>> BTW, I haven't seen any yet that provide the right
>> security settings for
>> either being a server to the outside world or just for
>> testiing, etc. etc.. They leave that up to the user
>> since there are so many different ways to do it. Keep in
>> mind I've only looked at the freebies that allow easy
>> setup for local server capability. Testing of code in
>> other words.
>
> There is pretty much documentation about how to secure PHP
> installations, if that was your question.

I don't recall the OP's original exact question any longer but that's one of
my points. RTFM. Additionally, those instructions are part of the download
package in most cases, not something you have to go googling for.
Re: Figure out path to php.ini [message #173513 is a reply to message #173510] Sat, 16 April 2011 20:35 Go to previous message
Jo Schulze is currently offline  Jo Schulze
Messages: 15
Registered: January 2011
Karma: 0
Junior Member
Twayne wrote:

> In news:4da8b7f7$0$6876$9b4e6d93(at)newsspool2(dot)arcor-online(dot)net,
> Jo Schulze <antispam(at)feuersee(dot)de> typed:
>> I beg you pardon but if you have a bunch of php.ini files
>> strewn around your hard drive, you have a probem. There
>> should be one php.ini for every SAPI avali, which limits
>> the number to a max of 3 (CLI, webserver module and
>> websever CGI). Well, thinking of it, possibly several
>> webservers are running at different ports, but for a
>> productive environment I say that you'll have a limit of
>> 2 (CLI and whatever for HTTP access).
>

> There's one for local server, others for remote serving,

WTF is "remote serving"? IMHO a server is defined to deliver data to
remote clients, thus remote is (a) redundant and (b) is nothing to
differ about

> a "bible" of
> important parts, etc.. It's not unusual and occurs on many of them.
> I'm not going back to see what each one is for, but it's all clearly
> documented. A newbie however, discovering he needs to work on php.ini
> can pretty easily get confused if he's the sort, as many are, who
> won't RTFM.
> So, no, I do not have a problem; you do, in that you think you can
> paint
> the whole world in one color. Don't not woik dat way.

What are you talking about? Deployment of php.ini files or what?

> if it's a turnkey freebie like there are so many of
> these days, it wll be pretty well spelled out n the docs
> that accompany it.
> Hard of reading/hearing?

Yes. No thanks for typing the same text again, I woulnd't have
complained if it would have made sense on the 1st try. It's still
glibberish to me.
for a non-native american/english speaker. I don't understand the above
at all.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: regexp
Next Topic: summing an array of arrays
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 18:56:39 GMT 2024

Total time taken to generate the page: 0.03092 seconds