Custom php.ini conflict with current htaccess


#1

i now maybe support is not officially to answer this, but maybe you can share information that will help

in past host i can use custom php.ini (shared hosting too) to complete what i needed, all works fine there

in dreamhost now i can create custom php.ini too (following this instruction http://wiki.dreamhost.com/Custom_PHP.ini )

the instruction says that i must add this line in htaccess :

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

the custom php.ini only works if i remove current htaccess (its conflict with present htacces) :

RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(adminarsitek/|modcp/|chat|cron)
RewriteRule ^(.*.php)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(adminarsitek|modcp|clientscript|cpstyles|images )/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]

what i need to do, i had working on this for two days and no solution yet, so i post here

i need custom php.ini because i need to enable allow_url_fopen=on


#2

Just follow the instructions, and add those lines to your existing .htaccess file (don’t replace it!).

Your new .htaccess file should now look like:

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(adminarsitek/|modcp/|chat|cron)
RewriteRule ^(.*.php)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(adminarsitek|modcp|clientscript|cpstyles|images )/
RewriteRule ^(. )$ vbseo.php?vbseourl=$1 [L,QSA]

I wish you hadn’t told me that…if you can’t figure out how to do this, you probably have no business turning allow_url_fopen on … Please tell me that you do know what you are doing and are not opening a huge security hole on your shared server. :wink:

–rlparker


#3

yup i had add it (not replace it) in htaccess like you wrote

but now every php files can not opened, try here http://www.indonesiaindonesia.com/forum.php
http://www.indonesiaindonesia.com/main.php

any suggestion what i need to edit so php files can viewed again? actually i just need one file that need allow_url_fopen enable, maybe i can setting just one file that using custom php.ini?

if i remove this it will viewed again

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

i know what i am doing and in my past host i am enable allow_url_fopen on too because script that i use need it

i had ask how to enable allow_url_fopen on here before http://discussion.dreamhost.com/showflat.pl?Cat=&Board=curious&Number=84827&page=0&view=collapsed&sb=5&o=14&part=


#4

ugh any idea guys?


#5

I suspect your rewrite rules are messing with the urls for the php files…hence the error.

–rlparker


#6

script that i use is using ioncube loader

is it custom php.ini any problem with ioncube loader?

i think that is the problem, because this rewrite rule is for that script


#7

I don 't know…I don’t use the ioncube loader. Have you installed it ?

–rlparker


#8

yup ofcourse ioncube is installed

the problem is just this rewrite rule from custom php.ini :

AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

and rewrite rule from my script :

RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_URI} !(adminarsitek/|modcp/|chat|cron)
RewriteRule ^(.*.php)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(adminarsitek|modcp|clientscript|cpstyles|images )/
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]

if i add those two rewrite rule together i cant open php files (always loading), but i can open php files again if i remove one of them (its conflict)

thanks for your help :), just let me know if you have solution for this


#9

Confzd1 found the answer to your problem, and posted it here.

–rlparker