On Thu, Sep 29, 2011 at 5:43 AM, Shaun Morrow <morrow.shaun@xxxxxxxxx>wrote: > I am running a server with cPanel on and want to have php run as a cgi > with > Suexec enabled > > I cannot seem to rectify an issue, when I set the handler to cgi, my > rewrite > rules on one of my sites stop working > > Sample url: http://examplesite.com/ad/123-abcde/ > > The rewrite rule for this is below; > > > RewriteEngine on > RewriteBase / > > RewriteRule ^ad/([0-9]+)(.*)$ > ./index.php/ads/ads/action/viewAd/frmAdsID/$1/adTitle/$2 [L] > > > Currently the php 5 handler is dso, and the rewrite rule works perfectly. > > If the handler is set to cgi, the rewrite rule does not work and I the site > just displays the home page. > > I am at a loss and would appreciate some help. > > Thanks in advance! > Did you make the changes accordingly in php.ini? I recall that cgi/fastcgi requires different configuration than from isapi type - dll/dso. I don't know how httpd handles impersonation on *nix platform as I've never had to configure it that way. Here's a few from the php.ini ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ; http://php.net/doc-root ; cgi.force_redirect is necessary to provide security running PHP as a CGI under ; most web servers. Left undefined, PHP turns this on by default. You can ; turn it off here AT YOUR OWN RISK ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; http://php.net/cgi.force-redirect ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with ; every request. PHP's default behavior is to disable this feature. ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://php.net/cgi.fix-pathinfo ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate ; security tokens of the calling client. This allows IIS to define the ; security context that the request runs under. mod_fastcgi under Apache ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. ; http://php.net/fastcgi.impersonate Note that the above is from old config file and is configured for PHP to run as FastCGI on IIS7.5. There maybe recent changes regarding httpd and impersonation. Go through the php.ini and make all relevant changes regarding 'cgi'. Regards, Tommy