How To Create a php.ini File with Complete Configurations
Let’s learn how to create a complete php.ini file with full configuration settings. When you want to run scripts which require certain Server Requirements like
safe_mode=off
display_errors=off
register_globals=off
increase or decrease
upload_max_filesize
post_max_size
max_execution_time
max_input_time
You can make changes using a custom php.ini file in the root.
When we upload a php.ini file with only few settings say for example; memory_limit = 128M,
Other settings custom settings may get change and your site may be broken.
How To Create a php.ini File ?
Step 1:
We should make a copy of our default php.ini file.
Create a php file naming it as myini.php using the snippet:
1 | <?php system("cp /usr/local/lib/php.ini /home/username/php.ini"); ?> |
For your convenience, Download myini.php here. Rightclick and save links as..
Change the ‘username’ to your controlpanel username.
Read Step1(b) for the second path in the above snippet.
Step 1(a):
If you are not sure how to create a php file,
Open notepad, paste the above snippet.
Go to File > Save As > File name: myini.php – Save type as: Choose All Files
Step 1(b):
And If you are not sure where your default php.ini file is located on your server,
Create a php file using Step 1(a) and name it as phpinfo.php with the below snippet:
1 | <?php phpinfo(); ?> |
Upload it to the root folder.
Visit www.domain.com/phpinfo.php on the browser.
Scroll down and Look for Loaded Configuration File.
Example: Loaded Configuration File : /home/username/public_html/php.ini
Step 2:
Go to www.domain.com/myini.php in your browser
Please note, It will be a Blank Screen only.
What happens is that a copy of your default php.ini file will be created in the root specified.
Step 3:
Use a FTP Client like FileZilla, download the default php.ini file.
Edit the php.ini file using a php-editor like Arisesoft Winsyntax. You can Download Winsyntax here.
Make the necessary changes required in the php.ini file.
Step 4:
Upload your new php.ini file to the root folder using the FTP Client.
Step 4(a):
To avoid showing your php.ini file, Add this to your .htaccess file:
1 2 3 4 | <Files php.ini> order allow,deny deny from all </Files> |
That’s it.


Edgardo
Jun 04. 2012
I am hosted on a shared host so i cant find the original php.ini with your method or maybe I’m doing something wrong where i can find a complete file php.pni file for php5+
thanks
Babaji M P
Jul 11. 2012
You need to have the Root Access, which isn’t given on shared environment.
But you can create a php5.ini file and upload it to your blog’s root directory.