tags:

views:

309

answers:

3

Hi,

I am using a shared hosting, i need to disable gettext extension for my application due i need to redeclare _(). Is it possible to disable an extension on php runtime or vie .htaccess ?

A: 

I don't think so, no. You'd need access to the php.ini to exclude modules from loading. See here.

There are two extensions that can redeclare functions: Runkit and APD

I have never worked with them myself, though.

Pekka
i am using shared hosting, so i am not able to access the php.ini, no way to overcome that ?
shuxer
I'm quite sure it's impossible. On shared hosting, the points from my edited answer won't help you either, unfortunately.
Pekka
+1  A: 

Wordpress uses __() (two underscores) and php-gettext for translation. I'm assuming they had exactly this issue, when deciding to go for __().

Boldewyn
the only way i guess, i will need to rename _() to __(), it will be so wasting of time :(
shuxer
True, but at the moment PHP's own gettext support is really crappy. However, renaming can be quite fast: `/([^a-zA-Z0-9_])_\(/\1__(/`
Boldewyn
+1  A: 

You can't. Your only option here to change php settings with an .htaccess file is to use

php_admin_value disable_functions

But as far as I know this only works for security related functions. The reason for this is that it would really kill performance if on every single request php had to rebuild the list of available functions which is what it would have to do if this was changeable on a per-server or per-directory basis.

Description of disable_funtions and php directives

pcp