KB5
KB5

Reputation: 128

Not able to get which php.ini is used

I am using apache 2.2 webserver (win 7 32,php 5.2 ) . trying to run php file in apache

i have added following statement in httpd.conf under apache conf dir to make php file run under apache (ref: http://goo.gl/jxKI)

LoadModule php5_module "C:/Program Files/PHP/php-5.2.6-Win32/php5apache2_2.dll"

things are working fine i am able to run php file under apache

Now i want to make some changes to php.ini but can't locate which php.ini file is being used. tried with my php.ini in php installation folder C:/Program Files/PHP/php-5.2.6-Win32/php.ini but this file is also no used.

phpinfo() gives path as c:\windows but there is no php.ini 
echo get_cfg_var('cfg_file_path'); doesn't return anything

please help me to solve this issue

Upvotes: 1

Views: 2640

Answers (5)

Craig Wayne
Craig Wayne

Reputation: 5068

Youu can quickly check via command line (terminal) with this:

php -i | grep /php.ini

Upvotes: 1

RandomSeed
RandomSeed

Reputation: 29809

You wrote:

phpinfo() gives path as c:\windows but there is no php.ini

This means your .dll expects the configuration file in c:\windows. Your tutorial mistakenly advises to create a configuration file in c:\php\php.ini. Move it to c:\windows, edit it to your liking, and it should work fine.

I would advise a beginner who seeks to learn PHP/Apache to use ready-to-use packages at first, such as WAMP Server. Manual installations require deeper understanding of PHP (and Apache to some extent).

Upvotes: 2

magento developer
magento developer

Reputation: 1

You can try phpinfo() function which will list the details of your php variables which apache is using. I think you can try this function and it will tell you which php.ini is loaded. Or also if you are using your own directory to store your project files, you can use .htaccess to override your module requirement or you can use php function to load your php module. Hope it will help you...

Upvotes: 0

Ja͢ck
Ja͢ck

Reputation: 173662

This is because PHP can run without a php.ini file.

Your Windows package (actually I think all bundles come with it) should come with these two files:

  • php.ini-development
  • php.ini-production

Renaming any of those two to php.ini and moving it into the search path (e.g. c:\windows) will make PHP load its configuration from that file.

Make sure to restart your Apache after making changes to it.

Upvotes: 1

user1299518
user1299518

Reputation:

you can use this function:

php_ini_loaded_file

Upvotes: 2

Related Questions