0

I follow this post to enable PHP5 XSL extension on apache server: .htaccess instead of php.ini

php_extension xsl.so

After added the line above, it show the 500 internal server error. and recommend?

soulmerge
  • 73,842
  • 19
  • 118
  • 155
Cheung
  • 15,293
  • 19
  • 63
  • 93

2 Answers2

3

Apache accepts PHP settings inside .htaccess files only if PHP is installed as a module and thus loaded as part of it. If PHP is set up as CGI you're out of luck - this won't work.

If you can't directly edit the php.ini try putting a php.ini in the same folder as the .htaccess (sometimes it just works - if there's suphp or phpsuexec installed).

Another thing you can try is dl().

djn
  • 3,950
  • 22
  • 21
0

I think php_extension xsl.so is not correct, allowed config for php apache modul is only php_value, php_flag, php_admin_value and php_admin_flag:

@see: https://www.php.net/manual/configuration.changes.php

I found the same post about loading php modules by htaccess, and I tried to load it with:

php_value php_extension curl

Tested in Apache/2.4.41 (Win64) and PHP/7.3.13

This makes no error 500, but it seems to have no effect on my loaded php modules (to allow overwriting apache config via .htaccess I enabled AllowOverride All).

And even if this works you should add <IfModule> blocks around this line like in this comment https://serverfault.com/a/1013773/200655

An alternative could be the php function dl() unfortunately it is removed in php apache module in many php versions.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Radon8472
  • 4,285
  • 1
  • 33
  • 41