1

I'm creating an app using CodeIgniter, but I'm unable to run Linux commands using my PHP script.

How do I run terminal commands?

I've tried shell_exec() and exec(), but both don't work while using CI.

kittycat
  • 14,983
  • 9
  • 55
  • 80
amarVashishth
  • 847
  • 3
  • 12
  • 26
  • Which command are you trying to run using exec() ? – Sumoanand Apr 26 '13 at 15:53
  • Put the following command in your php code to make sure that command is working: print exec('whoami'); Probably, there is issue with the command you are trying to run. Please provide more details to figure-out the issue. – Sumoanand Apr 26 '13 at 15:56
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. Debugging requests like your post should be posted as a comment. – kittycat Apr 26 '13 at 17:58
  • sure, i'll take care of that in future. – Sumoanand Apr 26 '13 at 17:59

1 Answers1

0

That depends on your server configuration if the functions are disabled, you need to enable them in your php.ini. Here are some alternatives:

rekire
  • 47,260
  • 30
  • 167
  • 264
  • commands like `ls` and `pwd` are working at their best using `system()` function but commands like `mkdir` experience an epic failure – amarVashishth Apr 30 '13 at 04:24