ionCube and CakePHP - help!

ionCube and CakePHP - help!

Posted by: spunko2010
Posted on: 2009-08-05 02:40:00

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:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

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?

http://forum.dreamhosters.com/troubleshooting/103905-Redirect-problem-with-htaccess-and-cakephp.htm
Edited by spunko2010 on 08/05/09 02:43 AM (server time).

Re: ionCube and CakePHP - help!

Posted by: Atropos7
Posted on: 2009-08-05 06:08:00

In reply to:

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.



Heh? What does error.log say?

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


Customer since 2000 cool openvein.org

Re: ionCube and CakePHP - help!

Posted by: spunko2010
Posted on: 2009-08-05 06:44:00

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/

Edited by spunko2010 on 08/05/09 06:46 AM (server time).

Re: ionCube and CakePHP - help!

Posted by: Atropos7
Posted on: 2009-08-05 08:03:00

In reply to:

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/


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 Edited by Atropos7 on 08/05/09 08:21 AM (server time).

Re: ionCube and CakePHP - help!

Posted by: spunko2010
Posted on: 2009-08-05 08:34:00

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?

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

Re: ionCube and CakePHP - help!

Posted by: spunko2010
Posted on: 2009-08-05 08:37:00

The CSS files now appear linking as follows:

"/cgi-bin/dispatch.cgi/css/style.css"



Re: ionCube and CakePHP - help!

Posted by: Atropos7
Posted on: 2009-08-05 14:15:00

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

Re: ionCube and CakePHP - help!

Posted by: spunko2010
Posted on: 2009-08-05 14:54:00

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:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

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

Edited by spunko2010 on 08/05/09 02:58 PM (server time).

Tags: ioncubeerror 500fplfcgihtaccesscgi bin