4GH is Go Daddy’s shared web hosting which employs some cloud technologies to improve load handling. For shared hosting it is fairly flexible in that you can use your own php.ini file – however they aren’t terribly forthcoming with how to do so. You can’t just add two lines to a blank php.ini and upload it as it overrides the default file if present, meaning all other directives must be included in your custom php.ini or a lot of things won’t work.
Here’s the best method I’ve come up with to allow you to change some settings while keeping the existing php.ini defaults in place – output the contents of the default php.ini which resides on the server outside of your hosting directory, save a copy, edit that and upload it. Then you will know all other config options are workable since they are an exact copy of the default one in place on the Go Daddy 4GH servers.
On Linux 4GH the default PHP memory is 64MB, you may have need to increase this value or make a few other changes to get your scripts running right.
The settings we’re looking at changing in the Resource Limits section:
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 64M ; Maximum amount of memory a script may consume (8MB)
Be a good neighbour, I’m assuming some hard limits are in place on what each account can actually use, don’t put stupid values like ‘memory_limit = 512M’ in on Go Daddy 4GH. If what you’re running could actually use that much memory, it would overwhelm most dedicated servers. Considering you’re operating on shared resources, I wouldn’t change any of these values to more than double what they are to start with. Despite what you may hear, 4GH does run Joomla, Drupal and WordPress sites very well with the default php.ini settings.
If you’re using something relatively heavy like the Drupal admin pages, you may need to up the max_execution_time to 60 seconds to prevent the script from timing out.
memory_limit = 128MB is fine, anything you run on there should work well within that, if it doesn’t- there is something wrong and you should pinpoint what’s running away with resources, especially if it is just a CMS like WordPress.
How to create your custom php.ini
1. Create a file named testinfo.php and include the following line:
<?php phpinfo(); ?>
2. Upload the file to your 4GH hosting account and open it in your browser at http://www.yourdomain/testinfo.php
3. Copy the path to php.ini from the php info output and paste it into an empty notepad so you don’t lose it – or go to a new browser window and leave the existing one open.
4. Create a new file named getini.php and include the following (in this example php.ini on Linux 4GH is located at /web/conf/php5.ini):
<?php echo nl2br( file_get_contents('/web/conf/php5.ini'));?>
5. Upload your new getini.php file to your 4GH hosting account and open it in your browser at http://www.yourdomain/getini.php
6. Copy all of the php5.ini text displayed in your browser and paste it into a text editor like notepad.
7. Make any changes you’d like to the copied php5.ini file.
Some fairly common line changes to allow a little more breathing room:
max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = 120 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume (8MB)
8. Save your php5.ini and upload it to the root directory of your 4GH hosting.
9. For Linux hosting, go to your hosting control panel and select from the top menu: Content->System Processes
10. Click “End web” this will stop and restart your Apache service and prompt the new php5.ini to be found.
11. If you are using Windows IIS hosting, go to your hosting control panel and select from the top menu: Content->IIS Management.
12. Click “Recycle App Pool”
13. This will do the same as “End web” on Linux
14. Go back to http://www.yourdomain/testinfo.php and verify that the new settings are in effect.
15. Important: Delete the testinfo.php and getini.php files from your hosting account so they can no longer be accessed.
16. If you want to revert to the default Go Daddy php5.ini at any stage, just remove your custom php5.ini and “End web”/”Recycle App Pool” again.
Hey James,
I tried to get my current php5.ini, but using your script I get the following error:
Warning: file_get_contents(ini”) [function.file-get-contents]: failed to open stream: No such file or directory in /home/content/19/userid/html/getini.php on line 1
I’m also getting divide by zero in line 1 error.
I’m on Linux 4GH hosting.
There’s a text encoding issue with the fancy quotes ” ” on this page. I just used the same line with singe quotes ‘ ‘ and works fine (as per the updated example above). I was able to replicate the problem by copying and pasting the original line into notepad++ then uploading it by ftp. If you then open it from the server, the quotes on that line won’t be quotes anymore. So there’s the problem. Just use single quotes around ‘/web/conf/php5.ini’ and it’ll be fine.
I’ve also put a current copy of the default linux php5.ini at http://www.jamesnorthway.com/gd4gh-linux-php5ini-24-12-2011.zip So you can modify that one and use it as well.