# Apache 2.4 + mod_cgid



## proton1234 (Dec 2, 2019)

Hi, could someone provide a link to a tutorial how to install Apache 2.4 + mod_cgid?


----------



## neel (Dec 2, 2019)

I use mod_fcgid on my webserver also. Assuming you want PHP, the instructions are as follows:

Install mod_fcgid:


```
pkg install ap24-mod_fcgid php73
```

Replace `php73` with the PHP version you want.

Then include this line in `/usr/local/etc/apache24/httpd.conf`:


```
LoadModule fcgid_module libexec/apache24/mod_fcgid.so
```

and


```
AddHandler fcgid-script .php
FcgidWrapper /usr/local/bin/php-cgi .php
```


----------



## proton1234 (Dec 5, 2019)

neel said:


> I use mod_fcgid on my webserver also. Assuming you want PHP, the instructions are as follows:


Thank you for your answer but could you post a complete config? what modules in apache should be enabled. As far as I can see php-fpm should be disabled?



neel said:


> ```
> AddHandler fcgid-script .php
> FcgidWrapper /usr/local/bin/php-cgi .php
> ```


Also `ScriptAlias  /  /var/my-www/` needed, not working without it (throws 403 error)


neel said:


> Install mod_fcgid:


What is better to use ap24-mod_fcgid or ap24-mod_fastcgi ?

What other modules can be used with php-fpm except mod_proxy_fcgi?


----------



## Lamia (Dec 5, 2019)

proton1234 said:


> What other modules can be used with php-fpm except mod_proxy_fcgi?


If mod_proxy_fcgi works, which it does and pretty fast, why change it? If you need to increase your server performance, maybe you need to increase its resources, set up a load balancer (HAProxy), cache, etc.


----------



## proton1234 (Dec 5, 2019)

Lamia said:


> If mod_proxy_fcgi works, which it does and pretty fast, why change it? If you need to increase your server performance, maybe you need to increase its resources, set up a load balancer (HAProxy), cache, etc.


Old version of my website CMS (php70) work correctly and pretty fast on a mod_proxy_fcgi  + php-fpm. But new version of the CMS on the same server with the same config (except php70 upgraded to php72) often fails with errors while cleaning cache. At the present time I'm unable to find the cause so I test CMS with all possible webserver configurations. As far as I can see mod_php seems Ok but slow,  now testing ap24-mod-fcgid.


----------

