CodeIgniter Forums
Use shell_exec - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Use shell_exec (/showthread.php?tid=70734)



Use shell_exec - omid_student - 05-22-2018

Hi
I can use shell_exec without codeigniter with below code
test.php in root :
PHP Code:
file_put_contents('temp.txt',json_encode($argv)); 
And call this file with below code :
PHP Code:
shell_exec("php test.php 'names' > /dev/null 2>/dev/null &")); 

But cannot use for codeigniter
Example :
localhost/users/remove
Try to use
PHP Code:
shell_exec("php index.php/users/remove 'names' > /dev/null 2>/dev/null &")); 
Not working
Thanks


RE: Use shell_exec - php_rocs - 05-22-2018

@omid_student

Are you getting any errors or warnings? Have you tried exec() instead?


RE: Use shell_exec - omid_student - 05-22-2018

(05-22-2018, 09:05 AM)php_rocs Wrote: @omid_student

Are you getting any errors or warnings?  Have you tried exec() instead?

return null result
Is it right code?


RE: Use shell_exec - InsiteFX - 05-23-2018

Read below, look for all the problems users were having with path problems.

PHP NET - shell_exec


You may need to set your path up for it to work.


RE: Use shell_exec - omid_student - 05-23-2018

(05-23-2018, 03:39 AM)InsiteFX Wrote: Read below, look for all the problems users were having with path problems.

PHP NET - shell_exec


You may need to set your path up for it to work.

Thanks but my problem is path


RE: Use shell_exec - InsiteFX - 05-23-2018

In that read it shows you how to see what path shell_exec is pointing to
and then how to change it.


RE: Use shell_exec - Paradinight - 05-23-2018

(05-23-2018, 04:35 AM)omid_student Wrote:
(05-23-2018, 03:39 AM)InsiteFX Wrote: Read below, look for all the problems users were having with path problems.

PHP NET - shell_exec


You may need to set your path up for it to work.

Thanks but my problem is path

change php to /usr/bin/php


RE: Use shell_exec - omid_student - 05-25-2018

(05-23-2018, 10:35 AM)Paradinight Wrote:
(05-23-2018, 04:35 AM)omid_student Wrote:
(05-23-2018, 03:39 AM)InsiteFX Wrote: Read below, look for all the problems users were having with path problems.

PHP NET - shell_exec


You may need to set your path up for it to work.

Thanks but my problem is path

change php to /usr/bin/php
Thank you
It is working now