3

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:\php\ext"

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_MACHINE\SOFTWARE (then I added \php) In which I added a string Value called IniFilePath and set the path to C:\php\php.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

Lain
  • 131
  • 1
  • 1
  • 4

1 Answers1

2

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"

Mukesh Jagani
  • 237
  • 1
  • 3