php.ini not being loaded [closed]

Posted on

php.ini not being loaded [closed] – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about windows, php, php.ini, , .

I have been trying to configure my Apache server all day, however I am having major issues with getting a php.ini file to be loaded.

When I try to connect to my database I get this error:

Call to undefined function mysql_connect()

After getting this error, I loaded up the php info page and relized my php.ini file was not being loaded as seen from here,

clip from my php.info page:

Configuration File (php.ini) Path   C:windows
Loaded Configuration File   (none)
Scan this dir for additional .ini files     (none)
Additional .ini files parsed    (none) 
  • I am running PHP version 5.6.21

This is on a windows machine.

Things I have done inside my php.ini file:

  1. have uncommented these lines:

extension=php_mysql.dll
extension=php_mysqli.dll

  1. Changed extension to: extension_dir = "C:phpext"

Have also added this to my apache config file :

LoadModule php5_module c:/php/php5apache2_4.dll
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

my php.ini file is inside c:php I have also tried putting it inside of Windows but Ideally I would like it in the php folder, however neither of these worked.

When I run php -m it does show both mysql and mysqli unde php modules.

I have also tried adding a php folder to my registry under
HKEY_LOCAL_MACHINESOFTWARE (then I added php)
In which I added a string Value called IniFilePath and set the path to C:phpphp.ini (also tried just C:php)

I did this because http://php.net/manual/en/configuration.file.php says it checks there before it checks inside the windows folder. However nothing I do seems to work.

How can I get it to load my php.ini file (ideally inside the php folder).

Please help

Solution :

It is looking for php.ini in c:windows. Did you restart the apache after changing the PHP path? You also need to correct PHP path with backward slash as it is windows machine.

PHPIniDir “C:/php”

Leave a Reply

Your email address will not be published.