Coding Tutorials and Blog Posts

How to Find the Location of Your php.ini File

tutuploadsphp.gif

A critical file you often need to manage is the php.ini file. It controls many import aspects of what you can and can not do with your site, including the size of files that you can upload.

Different hosts use different schemes for storing and accessing files and so you'll need to research where your php.ini file.

This tutorial will show you how to find the location of the file on any server.

Step 1. Create a script to display your php information

tutuploadsmedia_1330111995810.png

You'll need to create a very simple php script and place it in your home directory. Using a script editor or a plain text editor (not a word processor) create file called phpinfo.php with this code:

<?php phpinfo(); ?>

That's all you need. Just one single line. Save the file and call it phpinfo.php.

Upload this file to the public_html directory or whatever your main HTML directory is called.

In your browser address bar, access the file by typing in: http://yourdomain.com/phpinfo.php

You'll get a complete list of all your php settings. In the phpinfo.php page you can see:

  • the PHP version at the top of the file.
  • the location of your php.ini file

If you scroll down the page, and you can find the current version of MySQL. and php settings like safe_mode and register_globals and much much more.

tutuploadsmedia_1330112143774.png

This will work on your local computer using XAMPP or WAMP as well. This is what my XAMPP installation looks like.

GoDaddy Servers Are a Special Case

tutuploadsmedia_1330112626882.png

When you run phpinfo.php on the GoDaddy server you'll see the php5.ini file located in /web/config/php5.ini.

This folder is inaccessible using FTP or the File Manager in the control panel, so you cannot make changes to it if you need to fix errors. To fix this you need to make your own php5.ini file and upload it to your html directory.

tutuploadsmedia_1330112876304.png

Use FTP or your file manager to upload or create a php5.ini folder in your main directory on GoDaddy servers.

IMPORTANT: on GoDaddy, if you are running PHP 4, name your initialization file php.ini. If you are running PHP 5, name your initialization file php5.ini. Always upload the initialization file to the root directory of your site.

tutuploadsmedia_1330113031325.png

Now run your phpinfo.php script and you will see the path to the one you uploaded. You can edit this file to make changes to your PHP settings.

Comments

 
$herman
#1 $herman 2013-01-25 15:09

Thanks for informative article, it's bookmarked. Now all I need to do is figure out what settings I need.Getting "Warning: Cannot modify header information - headers already sent by (output started at /home/content/. .." error. You helped point me in the right direction. $herman
 
 
Tenshirou
#2 Tenshirou 2013-02-07 12:07

I uploaded the file php5.ini to my root directory html (he is the only directory that I have access)http://p uu.sh/1YMxJ but still having no effect puu.sh/1YMy2
 
 
leandantio18
#3 leandantio18 2013-03-18 10:35

I am using Godaddy server and I have created a program to upload large files. When I try to upload, after 4 min, the connection gets reset/timed out. I have made changes to the server control panel and also in my php.ini i.e I adjusted the memory_limit, max_upload_file size and post_maxi_size and still I face the same problem....so as you suggested in your article....if I create php5.ini will this solve my problem ??....Please help
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,244 training sessions in Joomla, Drupal, WordPress and Coding.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Copyright 2013 Open Source Training, LLC. All rights reserved.