Run this script to create custom php.ini file on Site5

I always run into a memory limit or upload limit issue with Site5. Luckily, they let you set your own php.ini file to up the limits. 

  1. Create an empty php.ini file in your public_html directory
  2. Copy this to a file in the root directory and name it something like phpini.php
  3. You will need to change the $customPath to match your directory. You can find this by creating a file and putting <?php phpinfo();?> in it. Or, if you have command line access, you can run the /cwd command.
  4. You may need to change permissions on the php.ini file to be written. 666 should work okay.
  5. Open the script in your browser by going to http://mysite/phpini.php (script found here:
- - Start Script Here - -
// Put all the php.ini parameters you want to change below. One per line.
// Follow the example format $parm[] = "parameter = value";
$parm[] = "memory_limit = 64M";

$parm[] = "upload_max_filesize = 400M";

$parm[] = "post_max_size = 100M";
// full unix path - location of the default php.ini file at your host
// you can determine the location of the default file using phpinfo()
$defaultPath = "/usr/local/lib/php.ini"; 
// full unix path - location where you want your custom php.ini file
$customPath = "/home/[site5username]/public_html/[]/php.ini";
// nothing should change below this line.
if (file_exists($defaultPath)) {
  $contents = file_get_contents($defaultPath); 
  $contents .= "\n\n; USER MODIFIED PARAMETERS FOLLOW\n\n";  
  foreach ($parm as $value) $contents .= $value . " \n";
  if (file_put_contents($customPath,$contents)) {
    if (chmod($customPath,0600)) $message = "The php.ini file has been modified and copied";
      else $message = "Processing error - php.ini chmod failed";
  } else {
    $message = "Processing error - php.ini write failed";
} else {
  $message = "Processing error - php.ini file not found";
echo $message;


Thanks Chris! Just what I needed and it worked perfectly.

thank you very much! i did not expect to resolve my memory prob that way, but it worked.

Thanks for an elegant solution! A couple of tweaks (escaping the folder separators in my file paths) and it worked perfectly for my GoDaddy windows hosting account.

but how to point this php.ini file to apache


thanks for the explanations. It's good to have advise when quick needing the correct command. For those who just wanna use it without knowing or thinking a lot about it: I found a cool tool on this. You give it the rights table and it generates the correct chmod command - for both: absolute and relative settings.

have fun with this. I hopethis helps a lot when hurrying with chmod....

At we needed to upload a file larger than 2m, to install a Joomla Community Builder CB1.4 on a new Joomla 1.6 install so we needed to create a customer php.ini. The host did not include easy php.ini editor in cpanel. Your snippet worked first time. Thanks you.