PHP.ini


#1

I’ve created a custom PHP.ini, at the default location, as per the wiki instructions. I now want to set it so only 1 folder (and it’s subfolders) actually use the modified PHP.ini file. How do I have to modify the .htaccess to do this?


#2

The .htaccess file needs to go into that folder. When it’s in the root folder of the domain, it applies to the domain and all its subfolders.

-Scott


#3

But it doesn’t work, and changing the location to include …/ thingies results in a 404.


#4

Works for me!

Well let’s try this again. I am assuming you are logging into a shell to do this …

~ = shortcut for your home directory eg /home/username
domain = your domain name

  1. mkdir ~/domain/cgi-bin
  2. nano ~/domain/cgi-bin/dispatch.cgi
  3. (paste contents of dispatch.cgi below and then press Ctrl-O, Enter, Ctrl-X)
  4. chmod 755 dispatch.cgi
  5. mkdir ~/domain/folder
  6. nano ~/domain/folder/.htaccess
  7. (past contents of .htaccess below and then press Ctrl-O, Enter, Ctrl-X)
  8. nano ~/domain/folder/test.php
  9. (past contents of test.php below and then press Ctrl-O, Enter, Ctrl-X)
  10. (Copy your PHP.ini file to ~/domain/cgi-bin)
  11. (Browse to http://domain/folder/test.php)
  12. (Should show Loaded Configuration File: /home/.glob/username/domain/cgi-bin/PHP.ini )

dispatch.cgi

#!/bin/sh export PHPRC=/home/username/domain/cgi-bin/PHP.ini exec /dh/cgi-system/php5.cgi.htaccess

AddHandler php5-cgi .php Action php5-cgi /cgi-bin/dispatch.cgitest.php

<?php phpinfo(); ?>Note: This does not enable PHP FastCGI.Did you want FastCGI enabled?

Customer since 2000 :cool: openvein.org


#5

I did all this according to the dream host wiki and it doesn’t work for me either. DH tells me that I have it still pointing to the DH cgi-bin, but I know I don’t. Anyone else get it working?


#6

So you are saying if you replace the disaptch.cgi script with:

#!/bin/sh echo "Content-Type: text/plain" echo "" echo "Hello World!"
that when you browse to a PHP script you get “Hello World!” ?

$ curl --url http://example.com/file.php Hello World! $

Customer since 2000 :cool: openvein.org


#7

If you mean that you’re trying to use “…/thingies” in your .htaccess file, then that isn’t necessary. Just leave the .htaccess lines as they are.

If you’re using an exec method such as /dh/cgi-system/php5.cgi that Atropos7 mentions above, then that’s correct.

Just leave all the cgi-bin stuff in place and only move the .htaccess file to those directories that you want to run under the custom php.ini.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost