Can't enable "exec" functions

BlazJ

New member
Joined
May 23, 2018
Messages
3
Hi.
For past week I have been in contact with several people from diferent supports and it seem noone can or is willing to fix a problem so I decided to do it on my own but there is a problem I can't find any files where I can remove "exec" from disabled functions wich is main reason my plug in won't work properly.

So far I learned I have shared webhos, aperently I have all admin rights in DirectAdmin program and it seem php.ini file doesn't exsist since I have been looking everywhere but can't find it. (even tried advance search but it just send me back to main site with files)

Is there any other sollutions for guy like me who don't know anything about it to fix it?
 
By default Directadmin parses additional .ini files in the <yourphplocation>/php.conf.d folder. Do you have ssh access on the server? If so, search for a file named '50-webapps.ini' in this folder, it will probably in there.

If you're using php-fpm and you want to enable exec for a specific user, you can edit this file (your php version may differ):

/usr/local/directadmin/data/users/<username>/php/php-fpm71.conf

and add the following line:

php_admin_value[disable_functions] = system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname

and restart the php-fpm service
 
I checked everything but couldn't find anything with that name.
As for ssh acess im not sure if I have it since others made this website for me and just aemd me details to log in DirectAdmin when asked to fix it.
If it helps it was made in wordpress.
 
I checked everything but couldn't find anything with that name.
As for ssh acess im not sure if I have it since others made this website for me and just aemd me details to log in DirectAdmin when asked to fix it.
If it helps it was made in wordpress.

Edit:
I found that file is located in " /usr/local/php56/lib " but I can't find any folders/files with that name.
 
So far I learned I have shared webhos, aperently I have all admin rights in DirectAdmin program
Looks to me this is a contradiction unless the shared hosting server is yours. And in that case you should have SSH access.

If it's a real shared hosting server, you shouldn't have access to /usr/local/lib/php.ini or kindlike files (like /usr/local/php56/lib/php.ini which is probably the reason why you can't find those.

Looks like the best opinion is to ask your webhoster if you are indeed on a shared hosting server, because in that case you won't be able to enable it yourself.
Next to that, most webhosters disable this for security reasons so the chance is not very big that they will enable it for you.

So in short:
a.) You are on a shared webhosting server -> ask your hosting provider, if he does not want to enable it, you can't enable it by yourself.
b1.) If you have a VPS and really -full- Directadmin access rights, you should also have root access to the server via SSH and you can enable it.
b2.) Same as b1 but in a managed situation, you have to ask the hoster which does the managing to enable it.
 
can't enable exec function

If you are hosted your site under shared server, you cant enable php functions as per your need, you must ask your hosting providers to enable it in server itself so that you can use those functions
If you are using VPS then you can be able to enable it by yourself using direct admin panel,
 
I installed directadmin on VPS and i was unable to enable the following extensions: exec, proc_open, popen
I tried searching for that which @wtptrs mentioned above but i was unable to do so at all. I searched php.ini in the panel but there was no such file named "php.conf.d" .. Is there any command for ssh to enable all these extensions? Also if there is, then please tell the command to disable as well. If it's something which could be done from the admin panel only, then please provide better steps and exact ones...
I am sorry but I am a beginner.. Hope no one gets dissapointed!

Thanks
Waiting for reply
 
Last edited:
Create this file if it does not exists:

\usr\local\php73\lib\php.conf.d\11-custom-global.ini (<-- this file won't be overwritten if you rebuild php)
(php73, do this for the php version you want.)

Code:
; custom php settings
;
;disable_functions=exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
; shell_exec allowed
disable_functions=exec,system,passthru,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname

You should alter it to allow exec. In my case I allowed shell_exec.

One disadvantage, this will be set for all users.
 
Hello Guys, Another Form.... Forced form to run.... in Directadmin...:)

I have this same problem, very times in the script called LARA CLASSIFIED, and I resolved the problem.

Inside the DIRECT ADMIN menu, painel, don´t have a securite way to resolv, i don´t found, but i can do making this to fix:

Steps:

1) CD / usr/local/directadmin/data/users/admin/php/
Find the file php-fpm81.conf


2) Create a copy of the file /usr/local/directadmin/data/users/admin/php/php-fpm81.conf to another name, like
/usr/local/directadmin/data/users/admin/php/php-fpm81work.conf

3) Edit the file php-fpm81work.conf

4) You then going to see (In mine is it):

php_admin_value[open_basedir] = "/home/admin/:/tmp/:/var/tmp/:/opt/alt/php74/usr/share/pear/:/dev/urandom:/usr/local/php74/lib/:/usr/local/php74/lib/:/usr/local/php81/lib/:/usr/local/lib/php/"

Change to:

php_admin_value[open_basedir] = ""

After test if work, run in shell:
systemctl restart php-fpm81.service
sudo apachectl restart

Don´t FORGET clean browse cache with CONTROL-F5 to test if the website work

TRY!!! If work, you need to do this steps too:
1) First make a file called forced.sh with content:
cp /usr/local/directadmin/data/users/admin/php/php-fpm81work.conf /usr/local/directadmin/data/users/admin/php/php-fpm81.conf
systemctl restart php-fpm81.service
sudo apachectl restart


Directadmin changes the file itself, putting the exec in the blocked functions. The idea is to make the machine's cron clean every half hour. Then the site can even go out, no more than 30 minutes.
Run CRONTAB -E
Create a line to run the copy
30 */3 * * * nice -n -19 sh /home/admin/domains/opcaogeral.com.br/forced.sh

:):)
If you link visit my website www.opcaogeral.com.br

Regards,
Daniel Fernando Ribeiro César
 
Change to:

php_admin_value[open_basedir] = ""
That's totally something different than enabling "exec" where this topic is about.

If you want the open basedir gone, you don't need to edit this file like this, might even give you more problems than solutions.
Furthermore this will not work if you change php version, because you have to change your cron again.

Much easier is to just disable open_basedir restriction in the admin panel under php settings if you don't need this.

Please do not update 2 year old post with off-topic "solutions" which can be even done in a better/easier way.
 
2) Create a copy of the file /usr/local/directadmin/data/users/admin/php/php-fpm81.conf to another name, like
/usr/local/directadmin/data/users/admin/php/php-fpm81work.conf

No need to create a secondary file. If you need to make changes to the php.ini in php-fpm, you can do so from Admin Level -> Custom Httpd Configuration -> domain.com: php-fpm

See https://docs.directadmin.com/webservices/php/php-fpm.html for more details.
 
Back
Top