Go Back   Web Master'S Zone > Web Design > Tutorials / Resources
Register Blogs FAQ Members List Calendar Mark Forums Read

Tutorials / Resources Tutorialize others and yourself with these useful how-to-do's and what-not-to-do's.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2008, 10:13 PM
Ehsan's Avatar
Administrator
 
Join Date: May 2008
Location: Pakistan
Posts: 136
Blog Entries: 1
Rep Power: 6
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
  #2 (permalink)  
Old 05-20-2008, 05:46 AM
Arania's Avatar
Too Cool To Chill
 
Join Date: May 2008
Location: In My Home
Age: 18
Posts: 50
Rep Power: 5
Arania is on a distinguished road
Send a message via AIM to Arania Send a message via MSN to Arania Send a message via Yahoo to Arania
Default

Nice Trick Ehsan,
But if you need to overwrite just a few settings, there is an easy way, by using .htaccess.
You can put a .htaccess file with your desired settings in the public_html folder.
Note - This may not work on some servers.
Regards
__________________
Reply With Quote
  #3 (permalink)  
Old 05-20-2008, 09:46 AM
Ehsan's Avatar
Administrator
 
Join Date: May 2008
Location: Pakistan
Posts: 136
Blog Entries: 1
Rep Power: 6
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
Default

Quote:
Originally Posted by Arania View Post
Nice Trick Ehsan,
But if you need to overwrite just a few settings, there is an easy way, by using .htaccess.
You can put a .htaccess file with your desired settings in the public_html folder.
Note - This may not work on some servers.
Regards
I tried th htaccess way but that didnt work
__________________
Reply With Quote
  #4 (permalink)  
Old 05-21-2008, 05:58 PM
Arania's Avatar
Too Cool To Chill
 
Join Date: May 2008
Location: In My Home
Age: 18
Posts: 50
Rep Power: 5
Arania is on a distinguished road
Send a message via AIM to Arania Send a message via MSN to Arania Send a message via Yahoo to Arania
Default

As I Said
Note - This may not work on some servers.
:P
Regards
__________________
Reply With Quote
  #5 (permalink)  
Old 05-30-2008, 10:05 PM
Crown's Avatar
Moderator
 
Join Date: May 2008
Location: UK, Devon
Posts: 71
Rep Power: 5
Crown is on a distinguished road
Send a message via MSN to Crown
Default

XD, Worked at my hosting
Sneaky stuff :P
Reply With Quote
Reply

Bookmarks

Tags
copy, php, phpini, serer



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:42 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.