Figure out path to php.ini [message #173401] |
Fri, 08 April 2011 15:50 |
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 #173403 is a reply to message #173401] |
Fri, 08 April 2011 16:07 |
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 #173479 is a reply to message #173401] |
Fri, 15 April 2011 09:13 |
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 |
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 |
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 |
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 |
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.
|
|
|