Joomla! Discussion Forums



It is currently Wed Nov 25, 2009 7:42 am (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security Checklist
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Custom php.ini file
Posted: Fri Aug 11, 2006 11:51 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Dec 13, 2005 10:57 am
Posts: 181
Location: Los Angeles
I read alot about global register_off being important for security reasons.

I asked my host site5.com and they directed me to this information. I hope it helps.


Also, i just wanted some to verify for me, if i added the right info

http://tips-scripts.com/?tip=php_ini#tip




- - 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[] = "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/user/public_html/php.ini"; <-- change "user" to mine
$parm[] = "upload_max_filesize = 4M";   <-- i added these lines regarding max upload and post max
// user specified max file upload size
$parm[] = "post_max_size = 10M";   
// user specified post max size
// 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";
  $handle = fopen($customPath, 'w'); 
  if (fwrite($handle, $contents)) { 
    fclose($handle);
    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;
?> 
- - End Script Here - -

_________________
http://www.iChoson.com
-------------------------------------------
Joomla 1.5.13


Last edited by dionysus on Sat Aug 12, 2006 12:33 am, edited 1 time in total.

Top
   
 
 Post subject: Re: Custom php.ini file
Posted: Sat Aug 12, 2006 12:04 am 
Joomla! Virtuoso
Joomla! Virtuoso
Offline

Joined: Fri Aug 12, 2005 7:19 am
Posts: 4471
Location: Leeds, UK
You will really need to check this with your host as many (if not the majority) of hosts do not allow you to override these settings


Top
  E-mail  
 
 Post subject: Re: Custom php.ini file
Posted: Sat Aug 12, 2006 12:35 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Dec 13, 2005 10:57 am
Posts: 181
Location: Los Angeles
1) I only changed 1 setting, and that was for the dir path.

2) I added the max upload and post max size.

It was my hosting company that gave me this info.

Cheers!

_________________
http://www.iChoson.com
-------------------------------------------
Joomla 1.5.13


Top
   
 
 Post subject: Re: Custom php.ini file
Posted: Sat Aug 12, 2006 1:36 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Tue Jun 06, 2006 7:41 am
Posts: 808
Location: Third planet from Sol
Looks good to me. I've used the same scripts for several sites at a different host. Worked perfectly every time.

Do this:
1. Check your global configurations to see that register_globals is ON.
2. In your script, change the setting register_globals to OFF (which in this case you've already done).
3. Run the script that creates your "custom" ini file. That's the one that should be created in the root directory of your Web site.
4. Run the script that copies your custom ini to all sub-directories.
5. Check your Global Configurations again. register_globals should now be OFF.
6. If it worked, start modifying other settings and and rerunning the scripts.
7. If something goes wrong, it's easy to back out by running the script for deleting ini files.
8. If you decide to keep the scripts on the site, I'd add a little security, such as placing them in a directory protected with .htaccess.

_________________
Web Home: http://www.ronliskey.com
Support http://support.educationgrove.com


Top
  E-mail  
 
 Post subject: Re: Custom php.ini file
Posted: Tue Aug 22, 2006 9:44 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Dec 13, 2005 10:57 am
Posts: 181
Location: Los Angeles
I checked my error log, and i am getting this error,

Can someone advise:

PHP:  Error parsing /home/xxxxxx/public_html/php.ini on line 8

_________________
http://www.iChoson.com
-------------------------------------------
Joomla 1.5.13


Top
   
 
 Post subject: Re: Custom php.ini file
Posted: Wed Aug 23, 2006 7:58 pm 
User avatar
Joomla! Master
Joomla! Master
Offline

Joined: Sun Oct 02, 2005 12:50 am
Posts: 12373
Location: Omaha, NE
dionysus wrote:
I checked my error log, and i am getting this error,

Can someone advise:

PHP:  Error parsing /home/xxxxxx/public_html/php.ini on line 8



Guessing here - Should that line read $customPath = "/home/xxxxxx/public_html/";

Regards

Dave

_________________
Regards, Dave Global Moderator
Your question has likely already been answered - Search the forums & the documentation wiki first - and only then post your question!
http://www.kiwaniswest.org
http://www.faysgifts.com


Top
  E-mail  
 
 Post subject: Re: Custom php.ini file
Posted: Mon Aug 28, 2006 9:26 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jan 19, 2006 4:12 am
Posts: 37
Is there a way to modify the executeable path so that my custom bin that contains the modules my host didn't provide doesn't have to be hard coded but would be found in the search?
Thanks
W

_________________
W


Last edited by wshealy on Mon Aug 28, 2006 9:46 pm, edited 1 time in total.

Top
   
 
Posted: Fri Jan 23, 2009 9:11 pm 
Joomla! Intern
Joomla! Intern
Offline

Joined: Sun May 28, 2006 4:38 pm
Posts: 85
i follow the instructions
made one file installphpini.php

Code:
// Put all the php.ini parameters you want to change below. One per line.
// Follow the example format $parm[] = "parameter = value";
$parm[] = "Display Errors = 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/dan12345/public_html/php.ini"; <-- change "user" to mine
$parm[] = "upload_max_filesize = 4M";   <-- i added these lines regarding max upload and post max
// user specified max file upload size
$parm[] = "post_max_size = 10M";   
// user specified post max size
// 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";
  $handle = fopen($customPath, 'w'); 
  if (fwrite($handle, $contents)) { 
    fclose($handle);
    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;
?> 


typed mysite.com/installphpini.php
and only get the code
Code:
// Put all the php.ini parameters you want to change below. One per line. // Follow the example format $parm[] = "parameter = value"; $parm[] = "Display Errors = 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/dan12345/public_html/php.ini"; <-- change "user" to mine $parm[] = "upload_max_filesize = 4M"; <-- i added these lines regarding max upload and post max // user specified max file upload size $parm[] = "post_max_size = 10M"; // user specified post max size // 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"; $handle = fopen($customPath, 'w'); if (fwrite($handle, $contents)) { fclose($handle); 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; ?>


what am i doing wrong


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group