|
#1
|
|||
|
|||
|
If you have SSH access (which can be requested), you can use the following command from shell:
Code:
phpiniuser='USERNAME' && cat /usr/local/lib/php.ini | replace 'register_globals = On' 'register_globals = Off' > /home/$phpiniuser/php.ini && chown $phpiniuser. /home/$phpiniuser/php.ini You can then add the following code to your .htaccess file: Code:
<IfModule mod_suphp.c> suPHP_ConfigPath /home/USERNAME <Files php.ini> order allow,deny deny from all </Files> </IfModule> Whenever someone requests a custom php.ini file through a support ticket, I have a hotcommand that fires a similar line that copies the file, chowns it, and auto-creates a .htaccess file in the /home/username. Since .htaccess interits by parent, then anything in /home/username/.htaccess will apply to all directories, thus the php.ini will apply. The FULL line I use to do all of this is: Code:
phpiniuser='USERNAME' && cat /usr/local/lib/php.ini | replace 'register_globals = On' 'register_globals = Off' > /home/$phpiniuser/php.ini && chown $phpiniuser. /home/$phpiniuser/php.ini && echo "######################################################" >> /home/$phpiniuser/.htaccess && echo "# Custom php.ini setup added by support, do not edit #" >> /home/$phpiniuser/.htaccess && echo "######################################################" >> /home/$phpiniuser/.htaccess && echo "<IfModule mod_suphp.c>" >> /home/$phpiniuser/.htaccess && echo " suPHP_ConfigPath /home/$phpiniuser" >> /home/$phpiniuser/.htaccess && echo " <Files php.ini>" >> /home/$phpiniuser/.htaccess && echo " order allow,deny" >> /home/$phpiniuser/.htaccess && echo " deny from all" >> /home/$phpiniuser/.htaccess && echo " </Files>" >> /home/$phpiniuser/.htaccess && echo "</IfModule>" >> /home/$phpiniuser/.htaccess && echo "### RESUME EDITING BELOW #############################" >> /home/$phpiniuser/.htaccess && chown $phpiniuser. /home/$phpiniuser/.htaccess Regards, -Eric Last edited by GatorThomas; 02-07-2009 at 01:06 AM. Reason: Remove unrelevant part after copying from another thread |
|
#2
|
||||
|
||||
|
Great post. It saved me life.
![]() One slight improvement for the shared hosting account owner: The one line script you provided in the first quote is good for someone who does that for a different account (i.e. administrator/root). For someone who does it for his own account only, one could eliminate the $phpiniuser and use the always present $USER environment variable instead: Code:
cat /usr/local/lib/php.ini | replace 'register_globals = On' 'register_globals = Off' > /home/$USER/php.ini
|
|
#3
|
||||
|
||||
|
GatorThomas may have edited out something more relevant than he thought...
__________________
Hosting term analogies, revised and improved (?) |
|
#4
|
|||
|
|||
|
Quote:
Great tip, saves me having thousands of php.ini files. However, after struggling with several scripts for a couple of nights, I realised that although it was released in July, HG has not updated to php 5.3. No matter, the answer is here and provides an easy method of enabling php5.3 which is great. The simple answer is, put these two lines at the top of your .htaccess Action application/x-hg-php53 /cgi-sys/php53 AddType application/x-hg-php53 .php However, the .htaccess trick stops working if you do this. You need to remove the <IfModule mod_suphp.c> so now it looks like: suPHP_ConfigPath /home/xxx <Files php.ini> order allow,deny deny from all </Files> Then it will work. Also, remember you will need to grab a new php.ini to customize, so where the script on this page refers to /usr/local/lib/php.ini you need to change it to /opt/php53/lib/php.ini so if you're using ssh, it would be (when in your home root folder) cp /opt/php53/lib/php.ini ./ |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SVN HowTo | Pablo | Shared Hosting Support | 16 | 03-26-2008 05:01 AM |
All times are GMT -5. The time now is 06:44 AM.











