Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with the php.ini file

Explorer ,
Jun 18, 2012 Jun 18, 2012

     On my new site, hosted over the web, I am looking for the php.ini file. I contacted the host, but of course you have to wait 24hrs and all, so I'm going to try and get an answer here. Where is the php.ini file? I searched the public_html directory, and every folder I can get my mouse on, but I can't find any trace of a php.ini. Do I make a new one? Can I download a php.ini.sample file just for reference? The only thing I really want to do is change the default timezone and maybe a few other things, but I don't want to rewrite the whole thing! Anyone have some advice, it'd be greatly appreciated!

Thank you,

Alex Liebscher

TOPICS
Server side applications
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2012 Jun 19, 2012

Depends on the server.  Usually in a PHP folder above the web root.  If you are on a shared hosting plan (meaning you don't rent the entire server or a VPS) then you won't find the file anywhere.  For server settings usually that's a script thing.  The script should set the timezone for your site.  The server timezone is set to where the server is.  So if the server is in NYC and you are in LA, the server will always be set to NYC EST timezone and not west coast time.  The script you use can set the timezone to show it locally to the user if it is not correct.  If it is something you want to change that the host allows depending on the configuration of the server you can create your own, or use htaccess files to overwrite the php.ini.  This depends on the server configuration and version of PHP (5.3/5.4 changed the way some of this is handled I believe).  So I would check with your host first on that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2012 Jun 20, 2012
LATEST

Thanks for the response! I bet your right, and that my hosted site doesn't put the file out there. Oh well. I actually found a function that you just put in your PHP that does the exact same thing as changing the php.ini's timezone would do. Here it is:

date_default_timezone_set("America/Los_Angeles");

On php.net, you can find a whole list of available timezones. Thanks for the tips though!

Alex Liebscher

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines