how to control ErrorDocument from .htaccess when we use PHP cgi-fcgi ?
when we use PHP-FPM the .htaccess is loaded correctly, but with PHP cgi-fcgi only *.shtml is loaded.
Yes, we can EDIT the files *.shtml but we need MANAGE ErrorDocument from OUR .htaccess
is possible enable the load of .htaccess when we use PHP cgi-fcgi ?, how?
thanks
-
I'm not sure if I understand what you mean by "load of .htaccess". :rolleyes: Apache reads .htaccess and in .htaccess you can use Apache directives (like ErrorDocument). 0 -
when we use PHP-FPM the .htaccess is loaded correctly, but with PHP cgi-fcgi only *.shtml is loaded. Yes, we can EDIT the files *.shtml but we need MANAGE ErrorDocument from OUR .htaccess is possible enable the load of .htaccess when we use PHP cgi-fcgi ?, how? thanks
look at this link it maybe it has some useful info? Local .htaccess strangely allowed running PHP in CGI/FastCGI mode in Apache under shared hosting environment0 -
What do you mean by "send .shtml to client"? 0 -
I'm not sure if I understand what you mean by "load of .htaccess". :rolleyes: Apache reads .htaccess and in .htaccess you can use Apache directives (like ErrorDocument).
thanks, this is my .htaccess:ErrorDocument 400 /mymanager.400.php ErrorDocument 401 /mymanager.401.php ErrorDocument 403 /mymanager.403.php ErrorDocument 404 /mymanager.404.php ErrorDocument 413 /mymanager.413.php ErrorDocument 500 /mymanager.500.php # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php81"" package as the default "PHP"" programming language. AddHandler application/x-httpd-ea-php81 .php .php8 .phtml # php -- END cPanel-generated handler, do not edit
but FOREVER any error load .shtml from cPanel0 -
What do you mean by "send .shtml to client"?
load the file code.error.shtml ( the default file from cPanel ) not MY "manager.error.php"0 -
thanks, this is my .htaccess:
ErrorDocument 400 /mymanager.400.php ErrorDocument 401 /mymanager.401.php ErrorDocument 403 /mymanager.403.php ErrorDocument 404 /mymanager.404.php ErrorDocument 413 /mymanager.413.php ErrorDocument 500 /mymanager.500.php # php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php81"" package as the default "PHP"" programming language. AddHandler application/x-httpd-ea-php81 .php .php8 .phtml # php -- END cPanel-generated handler, do not edit
but FOREVER any error load .shtml from cPanel
@quietFinn I thhink what he is trying to say is the erro documents that we have in cPanel are .shtml but they want to use there own error documents like below ErrorDocument 401 /mymanager.401.php ErrorDocument 403 /mymanager.403.php ErrorDocument 404 /mymanager.404.php ErrorDocument 413 /mymanager.413.php ErrorDocument 500 /mymanager.500.php so when he changes to cgi-fcgi when there is an error on the site the error documents are not his above they are the ones that cPanel supplies am I correct @0000 -
... when there is an error on the site the error documents are not his above they are the ones that cPanel supplies
yes!, is 100% true. web NOT LOAD OUR "manager.CODE.php", ignore our .htaccess and load .shtml from cPanel0 -
yes!, is 100% true. web NOT LOAD OUR "manager.CODE.php", ignore our .htaccess and load .shtml from cPanel
I have not tried it, but this is where that forum post says you can disable cPanel document error ? Tweak Settings -> System, " Copy default error documents to docroot for new accounts, addon domains, and subdomains "0 -
I have not tried it, but this is where that forum post says you can disable cPanel document error ? Tweak Settings -> System, " Copy default error documents to docroot for new accounts, addon domains, and subdomains "
thanks, we search how DISABLE default load of .shtml files, but we not find how disable for $user55cPanel0 -
thanks, we search how DISABLE default load of .shtml files, but we not find how disable for $user55cPanel
did you disable that feature in tweak settings ?Copy default error documents to docroot for new accounts, addon domains, and subdomains [?] When enabled, the system copies the default error documents to the document root directory when you create new accounts, addon domains, and subdomains. By copying the default error documents to the document root, this ensures that the global ErrorDocument configuration has the files its needs to prevent generating additional errors.
and did you remove the error documents in the cpanel user home directory ? just wondering.0 -
thanks, we search how DISABLE default load of .shtml files, but we not find how disable for $user55cPanel
Also did you restart apache server after make changes ?0 -
... and did you remove the error documents in the cpanel user home directory ?
in this case, result is 404did you disable that feature in tweak settings ?
how we do?, where we disable .shtml for user "sam" ? (not for ALL users)0 -
when we use PHP-FPM the .htaccess is loaded correctly, but with PHP cgi-fcgi only *.shtml is loaded.
I see you use php81 did you try php8 or php7.4 to see if it still use .shtml when using PHP cgi-fcgi ? just wondering if it has to do with php8.10 -
yes, we try with 7.4 and ALL is identic 0 -
yes, we try with 7.4 and ALL is identic
just being curious can you change the names of the files to test ErrorDocument 401 /mymanager.401.php ErrorDocument 403 /mymanager.403.php ErrorDocument 404 /mymanager.404.php ErrorDocument 413 /mymanager.413.php ErrorDocument 500 /mymanager.500.php ErrorDocument 401 /mymanager401.php ErrorDocument 403 /mymanager403.php ErrorDocument 404 /mymanager404.php ErrorDocument 413 /mymanager413.php ErrorDocument 500 /mymanager500.php not sure but test one mymanager401.php see if the extra "." confuse cgi-fcgi ??0 -
... not sure but test one mymanager401.php see if the extra "." confuse cgi-fcgi ??
many thanks by your help :-) we also try changing the name, and continue broken0 -
I tested this and it loads the errordocument I have in .htaccess file. PHP handler = fcgi, PHP version 7.4 ErrorDocument 400 /400.php ErrorDocument 401 /401.php ErrorDocument 403 /403.php ErrorDocument 404 /404.php ErrorDocument 413 /413.php ErrorDocument 500 /500.php Well at least 404 works... 0 -
I tested this and it loads the errordocument I have in .htaccess file. PHP handler = fcgi, PHP version 7.4
I found this 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 ?? :)0 -
it says you have enable AllowOverride in httpd.conf ?
I tested in a test server, AllowOverride is enabled by default.0 -
@cPRex any idea if you can turn off cPanel error document for a single user only 0 -
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. 0 -
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 mentionedIf 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 :)0 -
Since we're already into page 2 it's likely best for the OP to make a ticket to we can investigate in his environment directly. 0 -
... Well at least 404 works...
many thanks by your help :-) just we need for ErrorDocument 413 ( )0 -
... if the tweak is on OP says if he removes the files - he gets 500 error.
thanks!, ALL is 100% CORRECT! only: not error 500, error 4040 -
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 0 -
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: 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)0 -
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:0
Please sign in to leave a comment.
Comments
33 comments