View Single Post
  #1 (permalink)  
Old 05-19-2008, 10:13 PM
Ehsan's Avatar
Ehsan Ehsan is offline
Administrator
 
Join Date: May 2008
Location: Pakistan
Posts: 136
Rep Power: 9
Ehsan will become famous soon enoughEhsan will become famous soon enough
Send a message via MSN to Ehsan Send a message via Yahoo to Ehsan Send a message via Skype™ to Ehsan View Ehsan's Twitter Profile
Lightbulb Copying php.ini File From Server

Well i was working on this site of mine and wanted to edit the php.ini file to change some settings but my host didnt allow it so i searched around and found a way to do it manualy first you have to find where your php.ini file is located then use the path in another php file to copy it to your public_html directory and edit and upload it to all of your folders here is wat you have to do:

1. Finding Location of PHP.ini File:
PHP Code:
<?
phpinfo
();
?>
2. Edit the lines 8 and 10 with your own custom php.ini file path and save the file as copy.php and run it, your php.ini file will be copied to public_html
PHP Code:
<?php
// Put all the php.ini parameters you want to change below. One per line.
// Follow the example format $parm[] = "parameter = value";
$parm[] = "register_globals = Off";
$parm[] = "session.use_trans_sid = 0";
// 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/username/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;
?>
__________________
Reply With Quote