imperialWicket

am i the only croquet-playing computer nerd?

« AWS: Install Chicago Boss on Amazon Linux Tuning Apache for a low memory server (like AWS Micro EC2 instances) »

Increase PHP memory_limit on GoDaddy shared Linux hosting

2012-02-9

I have to look this up everytime, and for some reason it is really difficult to find a good resource. So after wasting another hour of my life searching random forums, here is what worked for me.

Using an FTP connection (it worked for me through a local FTP client or through the godaddy Hosting Control Center -> Content -> FTP File Manager), edit the php5.ini in your html directory. The full path is something like '/home/content/12/34567890/html/php5.ini' with different numerical values. Open that file. GoDaddy creates it for you when the account is created, if php5.ini is missing, someone probably deleted it, and you just need to make a new one.

In the php5.ini file, add the line:

memory_limit = 128M

The default is 64MB, which is enough for a lot of sites. Usually this needs to increase for the purpose of using particular extensions/plugins/modules in a CMS. Often image-handling extensions strongly encourage or even require 96M or 128M. I have not tested to see what the max is, but 128M is a good first step when 64M is no longer cutting it.

Now add a php file to that same 'html' directory. We need to use this for executing phpinfo(), and validating the change. Create a 'temp.php' file and add the line:

<?php phpinfo(); ?>

If you load your new temp.php page in a browser (yourPrimaryDomain.com/temp.php), you should see the PHP version you are using and all the PHP info details. A couple of these are of primary interest:

  • Loaded Configuration File
  • memory_limit

Unless you got really lucky, "Loaded Configuration File" is probably "(none)" at this point. If so, then your memory_limit value is still "64M". The problem is that your server has a fastcgi process running, and hence the php5.ini contents were loaded before you made the change. In order to reload the new php5.ini file, you need to kill off the existent web processes. Go to your hosting control center, then Content -> System Processes, now use the 'End Web' button to kill the running processes. This does not impede your site loading, it just forces the server to spawn a new process for the next request.

If you refresh the phpinfo page, you should see updated values for Loaded Configuration File and memory_limit. The server should have loaded your php5.ini file, and the memory_limit now reflects the updated value.

A couple other notes:

  • Be sure you edit the php5.ini file in your root 'html' directory. If you have subdomains or addon domains with their own directories, you still want to edit the file in your root 'html' directory.
  • Lots of places have data about php.ini affecting PHP 4 and php5.ini affecting PHP 5. One would think that since GoDaddy is no longer offering PHP 4, you could use either php.ini or php5.ini. Nope. Stick to php5.ini.
  • Don't try to use the php_value_memory_limit directive in your .htaccess file, this causes the server to throw errors.
  • I see lots of accounts that indicate you must use GoDaddy's FTP File Manager to edit the php5.ini file in order for it to work properly. I can't confirm this, and I can only assume that this direction was coincidentally related to running processes for the users that reported the behavior.

Now delete the phpinfo() file; I called it 'temp.php'. You do not want to leave these laying about your server. While I'm offering suggestions, you should also consider transferring to another hosting provider.

5 Responses to Increase PHP memory_limit on GoDaddy shared Linux hosting

Feed for this Entry

5 Comments

  • Your temp.php file should contain this instead.

    #8736 | Comment by Len on Jun 26, 2012 09:34am
  • Yeah, the comments stripped your tagged content, and my site doesn't have anything in place for handling > and < symbols.

    I need to get on that, thanks for reminding me.

  • That works! i was wondering whats going on when the changes in the php5.ini were not reflected.

    Thanks for the help.

    #9906 | Comment by mohamed azher on Aug 26, 2012 08:26pm
  • Why do you say: "While I'm offering suggestions, you should also consider transferring to another hosting provider." ??

    I have seen several say this, but I'm not sure why y'all don't like Godaddy. Can you give some reason(s)?

    Thanks
    Amber

    #15533 | Comment by Amber on May 6, 2013 01:02pm
  • @Amber - For me, it's 3 main reasons which may or may not be important to you:
    1. They tend to run old software on their shared hosting platforms. Ex. I believe their LAMP stack currently stops at PHP 5.2 (5.3 released in 2009) and MySQL 5.0 (5.1 released in 2005).
    2. They have the wrong balance of effort when it comes to customer service/support and customer upsell. Their site design is consistently put forth in a way that standard updates and changes require you to dismiss multitudinous upsell and special offers.
    3. Their strategies: Blatant objectivization of women was their core marketing strategy until recently and it still plays a huge role. They openly supported SOPA and similar legislation.

    I will grant the following: from a business perspective, flaunting scantily clad women on your ads works fine, and upselling at every turn is probably a good business technique.

    Also, they are pretty good about keeping their old software patched, so security is not a huge concern.

    With all of that, my general sense is to avoid them. If these factors are not important to you, or the couple dollars a month you can save are meaningful; GoDaddy may be a good choice. BlueHost, DreamHost, HostGator, NameCheap, Register, all offer similar services, and have a better reputation (imo).


About You

Email address is not published

Add to the Discussion

Search