PHP 7.1 How to disable unused BD resources?

Asked

Viewed 162 times

1

In php 7.1 the configuration of php.ini (original Locaweb) contains several BD commands that are not used.

I only use Mysql with PDO.

What can be disabled in php.ini and how to do it?

Below php.ini only with lines referring to Bds.

[SQL]
sql.safe_mode = Off

[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[MySQLi]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[Sybase]
sybase.allow_persistent = On
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off

[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10

[Informix]
ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = On
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0

[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off

1 answer

2

It is not necessary to remove the commands, just disable the add-ons you will not use, I made a brief explanation about this at:

So assuming that you will use only PDO with Mysql and will not use mysqli, you could comment on the lines like this using ; in php.ini:

If it’s Windows Server (or normal Windows):

;extension=php_mongo.dll
;extension=php_mysqli.dll
;extension=php_oauth.dll
;extension=php_oci8.dll
;extension=php_oci8_11g.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll

If it’s Unix-like:

;extension=mongo.so
;extension=mysqli.so
;extension=oauth.so
;extension=oci8.so
;extension=oci8_11g.so
extension=openssl.so
;extension=pdo_firebird.so
extension=pdo_mysql.so
;extension=pdo_oci.so
;extension=pdo_odbc.so
;extension=pdo_pgsql.so
;extension=pdo_sqlite.so
;extension=pgsql.so
;extension=pspell.so

If it is PHP7.2:

;extension=mongo
;extension=mysqli
;extension=oauth
;extension=oci8
;extension=oci8_11g
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=pspell

Note that the lines with ; will be ignored when you restart Apache (wamp, xampp, easyphp) or Ngnix, only lines without loading php extensions

Note: the above examples were from my PHP which is 5.4 and 7.2, are only examples

  • I read your other post and concluded that inhibiting does not improve performance. right?

  • What about security? Won’t leave paths open? Your guidance above goes for php 7.1 tb? Thanks !!

  • @Geo yes, it is little thing for some and for others a lot, it depends on the extension you want to disable, in general the legal is to remove what you will not use. This has no relation to security or faults, security is another problem, which is usually in your . php you wrote yourself. Yes for any version of php, but it’s just an example, you should analyze your own php.ini and see what you won’t use ;)

  • In my php.ini there is no line with Extension= , I have looked now. I think the inhibition should be done in my example above. Can you guide me? thank you

  • @Geo runs in a script . php o <?php phpinfo(); ?> it is possible that you are using .inis complementary

  • I got confused, I opened phpinfo and only shows mysqli (nor mysql what normal use/ and others php.ini appear) the version is php 7.1.7. It is normal?

  • Checks in the phpinfo the path of your php.ini. Maybe you are changing the incorrect file. Oh, and don’t forget to restart the php for the purposes of.

  • php.ini is at the root and equal to the one shown in info. Even to display it I unlock ini disable_functions which has other tb listed. And I also unlocked everything in ini. But it’s still the same. Could it be something from Locaweb? is shared hosting.

  • @Geo can yes, generally Locaweb uses linux, so it doesn’t have all because in linux vc installs via repository, already in windows vc downloads everything at once.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.