logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.



Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_fcgid and custom handlers
Author
kAlvaro



Joined: 29 Mar 2011
Posts: 4
Location: Spain

PostPosted: Thu 02 Jan '20 13:00    Post subject: mod_fcgid and custom handlers Reply with quote

I've successfully configured a development environment using mod_fcgid to run PHP. I define the scope with:

Code:
<FilesMatch \.php$>
   Options +ExecCGI
   SetHandler fcgid-script
</FilesMatch>


.. where fcgid-script is (I presume) a hard-coded handler provided by the module. To handle different PHP versions I keep a set of *.conf files and invoke the appropriate one inside every virtual host using Include. So far so good.

Some times I need to test a given feature in different versions within the same project. Since Include isn't .htaccess-friendly that implies restarting Apache. Trying to find an even more convenient way, I thought that perhaps I could feed SetHandler (which can be used in .htaccess) with a custom handler:

Code:
SetHandler php-5.3-script


Docs say that "Handlers can either be built into the server or included in a module, or they can be added with the Action directive" but here's where I got lost because Actions needs a URL-path.

Is what I'm trying to do not possible? Am I overlooking an easier way?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6745
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Jan '20 20:00    Post subject: Reply with quote

Hi,

what works is in *.config file

Code:

<Files ~ "\.php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "C:/php7/php-cgi.exe" .php
   </Files>



In .htaccess you can override the FcgidWrapper[1]

But you have to make sure not to set

Code:

FcgidInitialEnv PHPRC "C:\\php7"


since you can't override FcgidInitialEnv in a.htaccess file. I'm not sure PHP will pick the correct php.ini file. But it should. I haven't tried that since restating apache is easy.

If you still have a question please ask again.

[1] https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidwrapper

[2] see also https://www.apachelounge.com/viewtopic.php?t=2394
Back to top


Reply to topic   Topic: mod_fcgid and custom handlers View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules