how to control ErrorDocument from .htaccess when we use PHP cgi-fcgi ?

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
I tested this and it loads the errordocument I have in .htaccess file.
PHP handler = fcgi, PHP version 7.4
I found this Using .htaccess with FastCGI
it says you have enable AllowOverride in httpd.conf ?
maybe you can read this one and try it


Apache will read .htaccess files as long as AllowOverride is enabled in httpd.conf. What you cannot do is put PHP directives inside .htaccess: this works only with PHP installed as an Apache module and would cause a 500 Server error with PHP installed as either CGI or FastCGI.

Some configurations (with suphp and similar) allow for a per-directory php.ini with local settings. If this doesn't work with your setup you can change php.ini settings only with a series of ini_set() instructions (in an included file, most often)

just trying to Help ?? :)
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,239
363
cPanel Access Level
Root Administrator
Turning it off? I read through this thread and I'm not certain I 100% understand what we're trying to do.

By default, that Tweak Settings option is On for new systems, and that creates the 400-500.shtml files in the /home/username/public_html directory for all users on the machine. This allows Apache to serve a nice error page when something goes wrong on the domain.

If you don't want the files in place, you can just remove them from that particular user's public_html - they aren't automatically regenerated by any tools as they get created at the time the account is created.
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
I'm not certain I 100% understand what we're trying to do.
Basically the OP has his own Error Documents he want to use for one account.. he is using fcgi for the php handler. tried php81 php74 and it's not reading his .htaccess file?
When he changes to CGI or suphp it reads the htaccess file and works, he says only with Fcgi it doesn't read his htaccess file with his paths to his error documents,

- it seems that he wants the tweak on for other users for the cPanel error Documents, just not allow it for 1 specific user.

he does not want to edit the .shtml error documents just wants to use his own .php error documents just for one site as I mentioned


If you don't want the files in place, you can just remove them from that particular user's public_html - they aren't automatically regenerated by any tools as they get created at the time the account is created.
if the tweak is on OP says if he removes the files - he gets 500 error.

that's the best explanation I can give you for the OP :)
 

quietFinn

Well-Known Member
Feb 4, 2006
1,841
426
438
Finland
cPanel Access Level
Root Administrator
I don't know if it makes any difference in this case, but this is how we manage error documents in our servers:

1st make directory for the error documents:
mkdir /usr/local/apache/htdocs/errordocuments

2nd copy your own error documents to that directory, we have .shtml files

3rd in Apache Configuration -> Include Editor -> Pre VirtualHost Include:

Alias /ErrorDocuments /usr/local/apache/htdocs/errordocuments/

ErrorDocument 401 /ErrorDocuments/401.shtml
ErrorDocument 403 /ErrorDocuments/403.shtml
ErrorDocument 404 /ErrorDocuments/404.shtml
ErrorDocument 500 /ErrorDocuments/500.shtml
 
  • Like
Reactions: Spirogg

000

Well-Known Member
Jun 3, 2008
533
29
78
I don't know if it makes any difference in this case, but this is how we manage error documents in our servers:

1st make directory for the error documents:
mkdir /usr/local/apache/htdocs/errordocuments

2nd copy your own error documents to that directory, we have .shtml files

3rd in Apache Configuration -> Include Editor -> Pre VirtualHost Include:

Alias /ErrorDocuments /usr/local/apache/htdocs/errordocuments/

ErrorDocument 401 /ErrorDocuments/401.shtml
ErrorDocument 403 /ErrorDocuments/403.shtml
ErrorDocument 404 /ErrorDocuments/404.shtml
ErrorDocument 500 /ErrorDocuments/500.shtml
many thanks,

with this "CONTROL" is possible:

users using cgi-fcgi can choice WHAT FILE control errors ?

samply we need control errors from our PHP cgi-fcgi as this:


1648306087515.png

if we can control this from PHP, then we save event to MySQL, and then we can have strong reports by months, weeks, time, IP client, etc...

but again: PHP cgi-fcgi but many users NOT USE PHP cgi-fcgi then we need SOME users control errors from .htaccess, abd OTHERS from "cPanel default" (.shtml)
 

quietFinn

Well-Known Member
Feb 4, 2006
1,841
426
438
Finland
cPanel Access Level
Root Administrator
many thanks,

with this "CONTROL" is possible:

users using cgi-fcgi can choice WHAT FILE control errors ?
ErrorDocument is Apache directive, and it's Apache serving error documents.
As far as I understand it does not matter what PHP Handler is used, but maybe I'm wrong :rolleyes:
 

000

Well-Known Member
Jun 3, 2008
533
29
78
... As far as I understand it does not matter what PHP Handler is used, but maybe I'm wrong :rolleyes:
using PHP fpm-fcgi is possible get MANY info and process that, but using PHP cgi-fcgi Apache ignore our .htaccess

Agian: some solution please?