AddType for parsing PHP in xml files not working

#1
Hi, I have some RSS feeds being generated from a PHP array. I a while back moved my site to my own server where I run OpenLiteSpeed (reverse proxied through Nginx).

My feeds worked fine on the CloudLinux LiteSpeed hosting I used before, with PHP being parsed inside of XML files using this htaccess line:

AddType application/x-httpd-php .xml

However I cannot for the life of me get around why it isn't on my setup now (Ubuntu 18.04, OpenLiteSpeed reverse proxied through Nginx, LSPHP 7.4).

In the Webadmin panel, in the Server Configuration, I have a LiteSpeed SAPI script handler for lsphp74 with the suffix as "php". This should mean then that it's "x-httpd-php" so the AddType is correct from all I know of.

PHP all works fine, same with htaccess all works fine, but the PHP won't parse inside of XML despite I've told it to with htaccess, and if I view the source I can see the PHP code raw.

I've also tried doing this which should tell you what the handler is for PHP, which should come back as "x-httpd-php" but it's coming back blank.
<?php echo $_SERVER['REDIRECT_HANDLER']; ?>
I've also read about adding "AllowOverrides On" but I'm clueless with that and whether you do that with LiteSpeed.

Hope someone is able to help me work out what the heck is wrong here as I am clueless at the moment.
 

Pong

Administrator
#2
OLS only supports rewriterule in .htaccess, nothign else.
AddType application/x-httpd-php .xml
will simply be ignored by OLS since OLS doesn't support it.

in Scrtip handler, you can create Suffix "XML" and set lsphp74 to handle it. Don't foget to restart OLS in the end.
 
Last edited:
#3
OLS only support rewriterule in .htaccess, nothign else.
will simply be ignored by OLS since OLS doesn't support it.

in Scrtip handler, you can create Suffix "XML" and and set lsphp74 to handle it. Don't foget to restart OLS in the end.
Ok that's news to me, thanks! Done that now and works perfectly again! Thanks :)
 
Top