ionCube and CakePHP - help!


#1

Hi Guys

As you probably know, Dreamhost requires that we add this to the .htaccess in the root for ionCube to work:

#— DH-PHP handlers —
AddHandler php-cgi .php
Action php-cgi /cgi-bin/dispatch.cgi
#AddHandler fastcgi-script fcg fcgi fpl
#AddHandler php-fastcgi .php
#Action php-fastcgi /cgi-bin/dispatch.fcgi

When we do though, the rest of the .htaccess causes an Error 500, as I’m running CakePHP. If however I remove the parts of the .htaccess that are linked to our CakePHP software, ionCube works fine - but the website itself doesn’t load.

I need this in my .htaccess:

RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L]

We can’t have these both together for some reason? Can someone advise as to how to use both of these? Thanks!

This was posted before by a different user, is there ANY workaround?


#2

Heh? What does error.log say?

And is /cgi-bin a subdirectory of webroot or not?

Customer since 2000 :cool: openvein.org


#3

Hey

cgi-bin isn’t a subdirectory of /webroot/, does it need to be? I’ve left the cgi-bin where it was, in the site root.

Error log says this:

[Wed Aug 05 01:34:01 2009] [error] [client 87.197.8.xx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace., referer: http://www.domain.com/


#4

[quote]Hey

cgi-bin isn’t a subdirectory of /webroot/, does it need to be? I’ve left the cgi-bin where it was, in the site root.

Error log says this:

[Wed Aug 05 01:34:01 2009] [error] [client 87.197.8.xx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace., referer: http://www.domain.com/[/quote]
Wait, weren’t you following the CakePHP install instructions? They say to specify the document root (what you call the site root) as the path to the webroot directory. In other words, when you go to Domains -> Manage Domains and “Edit” the domain you should have the “Web directory” down as “/home/username/cake_install/app/webroot”

Next you edit /home/username/cake_install/app/webroot/.htaccess and add the lines for AddHandler and Action directives.

Then you make sure you have placed cgi-bin in the webroot directory. It’s documented that Action takes a url-path and not a file system path. This means /cgi-bin/dispatch.cgi needs to be in your document root (ie you can browse to http://example.com/cgi-bin/dispatch.cgi ) If it can’t process that URL Apache gets stuck redirecting requests (because with out it it can’t run PHP, but you’ve told Apache to run everything through PHP) In otherwords, to get a “Not Found” error instead, add this condition:

RewriteCond %{REQUEST_FILENAME} !cgi-bin

Well that works for me, though I’m not using ionCube Loader, just the customized PHP.INI setup, without modifying the CakePHP scripts.

Customer since 2000 :cool: openvein.org


#5

Hi thank you for your help so far. I followed your instructions and made sure I can access the cgi-bin frm the browser - www.domain.com/cgi-bin/, but still the problem persists, although instead of getting an Error 500 I am not getting no images or css to load. Could this be related to the .htaccess in the /app/ folder?

RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]

#6

The CSS files now appear linking as follows:

“/cgi-bin/dispatch.cgi/css/style.css”


#7

The CSS files now appear linking as follows:

“/cgi-bin/dispatch.cgi/css/style.css”

Confused. URLs like that should not appear in the HTML source (“linking”)

Try adding the RewriteBase directive to ~/cake_install/app/webroot/.htaccess

I don’t know why you’re having such a hard time with this. You probably need someone else with expertise to work on your site personally. This works with the latest stable release of CakePHP without any problem and I’m out of suggestions.

Customer since 2000 :cool: openvein.org


#8

Hi

This is almost fully sorted. I managed to install ionCube by removing the references to it in htaccess and doing it with PHP.ini only, and also adding (.*) to this:

RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]

So it now works. I have another error but I’ll open a new thread for that, thank you very much for your help !