Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable shell_exec() in wamp server

Tags:

php

wamp

Recently I have passed one issue on wamp server..I need to use the shell_exec() function in PHP for running some external shell script (some checksum file) . But in my wamp server the function is disabled by default. I searched in google but I cant find out the solution. So I try to put that code in live server. But there's also the same problem. I contacted the technical person for that server but he said we cant enable shell_script. It is security violence.

So only way is trying in wamp server... How to enable shell_exec() or exec() ..?

like image 267
Selva Avatar asked Oct 06 '12 07:10

Selva


2 Answers

The following line was the best I read to this problem: "You need to disable safe mode in the php.ini located in the \Apache2\bin folder, not the php folder. Restart Apache2 service right after to load the new settings."

The solution is:

  1. stop all services from Wamp-Server and close the programm

  2. Open .../wamp/bin/apache/Apache2../bin/php.ini

  3. copy php.ini to desktop and open it

  4. set safe_mode_exec_dir (line after = is empty, so IT IS ON!!!) set it off!

  5. save

  6. copy back to dir (maybe you need admin rights)

  7. start wamp-server

  8. enjoy exec() and co.

like image 81
Sturmi Avatar answered Sep 21 '22 09:09

Sturmi


I was having the same problem and tried a lot of solutions out there. What worked out for me was running XAMPP as Admin.

like image 28
leplandelaville Avatar answered Sep 25 '22 09:09

leplandelaville