Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I modify disable_functions using PHP code, or doing it in a way that doesn't involve modifying php.ini?

Tags:

php

exec

I was wondering if there was a method of editing disable_functions (so as to enable the exec() function) by using PHP code, or just in a way that won't involve access to the php.ini file? If so, what would that be?

like image 683
Alper Avatar asked Oct 21 '25 05:10

Alper


2 Answers

I was wondering if there was a method of editing disable_functions (so as to enable the exec() function) by using PHP code,

No, because that would make disable_functions completely useless: Its there for security reason, but where is the security, when everybody can change it?

or just in a way that won't involve access to the php.ini file?

Nope.

If so, what would that be?

Changing the hoster, I guess.

like image 103
KingCrunch Avatar answered Oct 23 '25 19:10

KingCrunch


If your server is suphp enabled or if php is compiled as cgi &

the hoster has not specifically disabled use of local php.ini file,

then you will be able to override even disable_functions using a local php.ini file

Add a php.ini file with all your requirements on the document root of your website. It's recommended that you use the global php.ini used on the same server as a template php.ini file, and then modify the line -

disable_functions

so that exec is not present. This will work because as soon as you place a local php.ini on an suphp enabled server, the domain will stop using the global php.ini

like image 21
Amal Abdul Majeed Avatar answered Oct 23 '25 19:10

Amal Abdul Majeed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!