• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use shell_exec

#1
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
Reply

#2
@omid_student

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

#3
(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?
Reply

#4
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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
(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
Reply

#6
In that read it shows you how to see what path shell_exec is pointing to
and then how to change it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
(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
Reply

#8
(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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.