Alper
Alper

Reputation: 1

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

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?

Upvotes: 4

Views: 3838

Answers (2)

Amal Abdul Majeed
Amal Abdul Majeed

Reputation: 11

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

Upvotes: 1

KingCrunch
KingCrunch

Reputation: 132051

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.

Upvotes: 6

Related Questions