Click to See Complete Forum and Search --> : where to place php.ini


org_user
04-03-2008, 03:39 AM
I have configured php to work with MySQL and MSSQL for that I have placed php.ini file in C:/windows.

In order to test I have created two php files
1)php file which included database connection related code using mysql_connect and mssql_connect functions.This file is working and database connection is established.
2)php file to display today date.<?print strftime("%d-%m-%y");?>.This file is not working and displaying blank screen.

If I place php.ini file in C:/php, php file to display date is working and the first file for database connections is not working and a"fatal error:cannot find function mssql_connect()" is displayed

Where do i place php.ini file inorder to work my database php file and date php file

laserlight
04-03-2008, 04:19 AM
Check phpinfo() for "Loaded Configuration File". You can change which php.ini file is loaded with PHPIniDir directive for Apache (if you are using it).

phaseonemedia
04-03-2008, 04:33 PM
also, <?print strftime("%d-%m-%y");?>? will that syntax work?
shouldnt it be <? print strftime("%d-%m-%y");?> for short_tags. or
<?php print strftime("%d-%m-%y");?> -shrugs- could just be a typo, but you never know. :)

laserlight
04-03-2008, 05:15 PM
also, <?print strftime("%d-%m-%y");?>? will that syntax work?
Yes, but since short_open_tag should be off, one should not be using that in the first place.

phaseonemedia
04-03-2008, 05:26 PM
indeed, off is the default

bradgrafelman
04-03-2008, 10:27 PM
Also note that it's strongly urged (by PHP guru's as well as the PHP.net manual itself) to NOT move PHP-related files outside the main PHP installation directory (e.g. c:/php/).

kmjamal
04-17-2008, 08:24 PM
keep it under root directory that is public_html

bradgrafelman
04-17-2008, 08:56 PM
The php.ini should definitely not be placed in a folder accessible by the web (e.g. public_html) - that's not information that the world needs to see.