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?
PHP.ini
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
But it doesn’t work, and changing the location to include …/ thingies results in a 404.
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
- mkdir ~/domain/cgi-bin
- nano ~/domain/cgi-bin/dispatch.cgi
- (paste contents of dispatch.cgi below and then press Ctrl-O, Enter, Ctrl-X)
- chmod 755 dispatch.cgi
- mkdir ~/domain/folder
- nano ~/domain/folder/.htaccess
- (past contents of .htaccess below and then press Ctrl-O, Enter, Ctrl-X)
- nano ~/domain/folder/test.php
- (past contents of test.php below and then press Ctrl-O, Enter, Ctrl-X)
- (Copy your PHP.ini file to ~/domain/cgi-bin)
- (Browse to http://domain/folder/test.php)
- (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.cgi
test.php
<?php phpinfo(); ?>
Note: This does not enable PHP FastCGI.Did you want FastCGI enabled?
Customer since 2000 openvein.org
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?
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 openvein.org
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