change php settings in your hosting account - inmotion hosting

3

Click here to load reader

Upload: coklat

Post on 01-Oct-2015

216 views

Category:

Documents


1 download

DESCRIPTION

Change PHP Settings in Your Hosting Account - InMotion Hosting

TRANSCRIPT

  • Written by Brad Markle Views: 57,103 Published: Oct 7, 2014 Comments: 15

    View of the php.ini in the

    Change PHP settings in your hosting account

    PHP is a scripting language used primarily on the web. PHP is highly customizable and has many settings that our users canmodify themselves. This article will advise you how to change PHP settings in your php.ini file/

    How to view your current PHP settingsTo view your current PHP settings, create a PHPinfo page. If you're not sure how to do this, please see How can I view my PHPsettings using a PHPinfo page ?

    The steps in updating the values listed in your PHP info page depend on how PHP is setup on your particular server. In general,PHP runs on our servers as either:

    Apache moduleCGI Module

    To find out how PHP is configured on your server, create a PHP info page (via the above instructions) and look at the "Server API "'value. If the "Server API " is "CGI ", then PHP is running as "CGI module" . If "Apache " is listed, then your server is running PHP asan "Apache module" .

    Server API: ApacheIf your server runs PHP as an "Apache module ", you can change your PHP settings via a .htaccess file. A .htaccess file is aconfiguration file you can create and use to change many server settings, including PHP settings. The basic syntax to use in your.htaccess file for updating PHP settings is:

    php_value Directive value

    For example, if you wanted to change the max_input_time from 60 seconds to 120 seconds, add the following to your .htaccessfile:

    php_value max_input_time 120

    After making this change, refresh your PHP info page, and you should see the changes. If you receive a 500 error, please doublecheck the syntax you used as you may have made a misspelling.

    If you don't have a .htaccess file, you can simply create a new file named .htaccess. As the .htaccess file begins with a dot (.), it isconsidered a hidden file. If you are using the cPanel's File Manager, please be sure to select the option to Show Hidden Files(dotfiles) , otherwise you will not be able to see your .htaccess file. If you do not see this prompt when opening your File Manager,click the, "reset all interface settings" link at the bottom of your cPanel to reset your File Manager settings.

    Server API: CGIIf your server runs PHP as a CGI module, you can change your local php.ini file in order to makemodifications to your PHP setup. php.ini is a PHP configuration file with a list of PHP directives andtheir values. In the above example, we modified the max_input_time value. If you open your php.ini fileand search for max_input_time, you should see something similar to:

    ;;;;;;;;;;;;;;;;;;;; Resource Limits ;;;;;;;;;;;;;;;;;;;;

    1 of 3

  • File Manager

    Step 1.

    Step 2.

    Step 3.

    Step 4.

    Step 5.

    max_execution_time = 30max_input_time = 60memory_limit = 256Mupload_max_filesize = 10M

    To change the max_input_time from 30 seconds to 120, for example, simply change 30 to 120 and save the file. Refresh your PHPinfo page, and you should see the changes.

    Increasing PHP memory in the php.iniA common issue when using free open source software or other PHP intensive programs is the "exhausted memory " error. If youhave a PHP memory error on your site, you can increase the memory limit PHP uses for the scripts. To learn how to change thememory limit in your php.ini, please see the following link.

    Fixing the Allowed memory size exhausted error

    Modifying the PHP.INI fileHere is a quick step-by-step tutorial on editing the PHP.INI file.

    Login to the cPanel.

    Find the File Manager in File section of the Cpanel. Review our tutorial on usingthe Code Editor within the File manager if you're looking on information how touse it.

    Navigate to the directory where you will either save or edit the PHP.INI file andthen select the file and use the Code Editor. To open the file, you can click on itto select the file and then click on the Code Editor icon in the menu bar of theFile Manager. You can also right-click with your mouse and select Code Editor from the menu that appears.

    Edit the section of the PHP.INI that you wish to change.

    Click on SAVE CHANGES in the top right hand corner in order to save your modifications or additions to the file.

    Common Problems when Updating your php.ini file

    I don't have a php.ini file!Only users running on a server with PHP loaded as a "CGI module " will have a php.ini file. The php.ini file by default will be located atpublic_html/php.ini. If you do not see a file named php.ini in your public_html, please contact our Support Department andrequest that we create one for you.

    I made changes to the php.ini file, however I do not see the changes!The php.ini file is not recursive. Updating your php.ini values in public_html/php.ini will not affect PHP files in subfolders of yourpublic_html, such as public_html/staff. To correct this problem, you can make your php.ini file recursive so that it affects all subfolders. More help on this can be found in How can I make my php.ini file recursive?

    Considering a VPS or Dedicated Server?

    2 of 3

  • With a VPS or dedicated server, a site owner can truly customize the server to their exact specification. If you are on a SharedHosting account, and are thinking about upgrading from to a VPS or dedicated server, click here to read more about a VPS vsdedicated server.

    3 of 3