1

I have installed php 5.6 in centos 6.7 server using

yum --enablerepo=remi,remi-php56 install -y php-mysqlnd php-gd php-mbstring php-mcrypt php-xml php-fpm

I have the following php extensions enabled :

<?php
print_r(get_loaded_extensions());
?>

[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
[7] => filter
[8] => hash
[9] => Reflection
[10] => SPL
[11] => session
[12] => standard
[13] => cgi-fcgi
[14] => ctype
[15] => curl
[16] => ftp
[17] => gd
[18] => mbstring
[19] => mcrypt
[20] => mysqlnd
[21] => PDO
[22] => SimpleXML
[23] => mysql
[24] => pdo_mysql
[25] => json
[26] => mhash

To save php memory usage, I disabled many php extensions in /etc/php.d folder.

I would like to disable some more like :

libxml, ereg, mhash, Reflection, SPL etc.

However, these extension files are not in /etc/php.d folder.

So, please suggest me how to disable extensions like libxml, ereg, mhash, Reflection, SPL etc.

Also, please suggest if it is safe to disable them.

Please reply if you would like to know more details.

Thanks.

Arnold
  • 129
  • 1
  • 4

3 Answers3

2

All of these are compiled in PHP. So you can't disable them without recompile the packages.

But your memory is so important ? I don't think it will change a lot of thing to disable that. If you recompile the packages, could you give us the differnence of memory used with/without ?

Thanks!

Dom
  • 6,628
  • 1
  • 19
  • 24
2

Important work have be done (since 5.3) to build most extensions as shared, so can be disabled. And I really think you cannot disable more.

Ex:

  • SPL cannot be disabled, and you always need it (at least for autoloader)
  • session is obviously mandatory
  • mhash is a fake ext provided by hash which is used by session, so also mandatory
  • etc

More explanation in the Fedora PHP spec file: http://pkgs.fedoraproject.org/cgit/php.git/tree/php.spec?id=98ce5ad0385bfb5679a731a1df48b82b22718bc6#n860

Remi Collet
  • 2,061
  • 1
  • 11
  • 12
0

From command-line interface, you may specify -n to disable loading all extensions (but not some), e.g.

php -n -r "phpinfo();"
kenorb
  • 5,943
  • 1
  • 44
  • 53