Skip to main content

How to edit php.ini in the cpanel

It is often required to change some settings in the php configuration of our site. If you have access to the cpanel of your hosting provider, then the below steps can help you in modifying the settings in php.ini file..... (Note: these steps are specific to hostmonster)

Step 1- Login into your cPanel.
Step 2- Under the Software/Services category, click on the PHP Config icon.
Step 3- In this screen, there is a section called Install Default php.ini. Under that section, please check mark the "IonCube" and the "SourceGuardian" check boxes (Many commercial php scripts need these turned on - if you think your script may not require the IonCube or SourceGuardian packages, it is okay to not check mark the boxes - but it will not hurt anything to check mark both boxes.).
Step 4- Under the same section, click the "INSTALL PHP.INI MASTER FILE" button.
Step 5- You have just successfully installed the "php.ini.default" file . But the next step is to rename it from "php.ini.default" to just "php.ini" to make it active. You can do the Rename in the File Manager screens. Under the Files category in your cPanel, please click on the File Manager icon.
Step 6- When you click on the File Manager icon, you should get a popup dialog titled "File Manager Directory Selection". (If you do not see the popup dialog, then you need to click on the link at the bottom of your cPanel called "reset all interface settings" - and then Refresh your cPanel and click on the File Manager icon again.) In the popup dialog screen, click the "Web Root (public_html/www)" and the "Show Hidden Files (dotfiles)." choices. Finally please click the "Go" button.
Step 7- If you already have a "php.ini", I would recommend that you Rename the file to "php.iniOld" in case you need ever need it.
Step 8- Find the file that you just installed called "php.ini.default", Right-Click the file and choose the Rename option.
Step 9- A new popup dialog called Rename should appear. Please start pressing your Backspace on your keyboard and you will start to see the letters disappear. Keep removing the letters until you see only "php.ini", and then click the Rename File button.
Step 10- Your php.ini file is now active and fully functional !! Additionally, some users need to make adjustments to this file. To edit the file, you just Righ-Click the php.ini file and choose the Edit option, and then change the value like these examples show:
a. To increase your memory for your php pages: memory_limit = 2M ---> memory_limit = 100M
or
b. To turn on your Register Globals: register_globals = Off ---> register_globals = On (We don't recommend that you change this flag unless you know what you are doing.)
or
c. To increase the maximum file size for uploading (there are two flags that you have to change):
post_max_size = 2M ---> post_max_size = 100M
upload_max_filesize = 2M ---> upload_max_filesize = 100M
Step 11- Important: The php.ini file is generally directory specific. If you have "PHP5 (Single php.ini)" or "PHP5 (FastCGI)" selected in your Php Config screen, then you should not need to do anything else. If you do NOT have either of those selected, then you may need to copy the php.ini file into all of the subfolders inside your public_html directory. This may be dozens and dozens of subfolders that you have to copy the file into. Also, sometimes it can take between 15-30 minutes before the system recognizes the php.ini file or any changes that you have made in the file.

Comments

Popular posts from this blog

Retaining checkbox status of a form after submitting it

we will learn here how to post back or retain the value ( status ) of the checkbox. We will use php header redirection to post back the values to our main page where checkbox is present. We will call form page as first page and action or submitted page as second page. The form data will be received by second page and it is supposed to post back the form data back to form page by using query string through address bar. To keep the second page simple we will keep only the redirection part. Here we have excluded the part which takes care if the form passes its validation and execute the actual script (redirection part). Here is the code of our form with two checkboxes, pb-check.php <?php $t1=$_GET['t1']; $t2=$_GET['t2']; if($t1=="yes"){$t1v="checked";} else{$t1v=="";} if($t2=="yes"){$t2v="checked";} else{$t2v=="";} ?> HTML Form code: <form method="post" action="pb-chk.php"> <inp...

Identify the user's browser

Sometimes there arises a need to identify the user's browser. It is pretty easy to find browser with jquery. So if you have included jquery in your page, it takes a simple line to identify the browser:  if ($. browser . msie ) {} // IE if (($.browser.msie) && ($.browser.version == '6.0')) {} // IE6 if ($. browser . opera ) {} // opera if ($. browser . mozilla) {} // Firefox With the help of php, you can get the browser  details with the help of:  $_SERVER['HTTP_USER_AGENT']; Or you can even use the combined version of php and javascript. php + javascript code: <script type="text/javascript"> var string1 = "<?php echo $_SERVER['HTTP_USER_AGENT']; ?>"; // Browser string var myRegExp1 = /Firefox/; var matchPos1 = string1.search(myRegExp1); var myRegExp2 = /Chrome/; var matchPos2 = string1.search(myRegExp2); var myRegExp3 = /MSIE/; var matchPos3 = string1.search(myRegExp3); if(matchPos1 != -1) ...

Facebook connect using graph api

An example of using facebook graph api to authenticate users: Setup a new application in facebook apps and get the app id and secret. Now follow the steps: Remember to give the same url in the below code, as that of the app settings. <?php if( !isset($_GET['code'])) { ?> <a href="https://graph.facebook.com/oauth/authorize?client_id=xxxxxxxx&redirect_uri=http://xxxxxxxxxxxxxxxx/">Connect using Facebook</a> <?php } $code = trim($_GET['code']); if(isset($_GET['code'])) $token = file_get_contents("https://graph.facebook.com/oauth/access_token?client_id=xxxxxxxx&redirect_uri=http://xxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxx&code=$code"); $token = explode("=", $token); if(isset($_GET['code'])) $user = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$token[1]));  print_r($user); ?>