Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 05-23-2018, 04:35 AM by omid_student.)

(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




Theme © iAndrew 2016 - Forum software by © MyBB