PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 3, 2022

[FIXED] How can I run a linux command on Windows XAMPP with shell_exec()

 July 03, 2022     cmd, php, shell, xampp     No comments   

Issue

I would like to run a sed command in my php script via shell_exec but I get the following error:

'sed' is not recognized as an internal or external command,
operable program or batch file.

Which is because XAMPP uses the windows shell.
Is there any way I could configure it to use a linux shell?


Solution

The PHP shell_exec will try to run the command in the host system. Therefore you cannot run linux command on windows.

If you really want to try running that in windows and you have windows 10 maybe you can try using wsl ( windows subsystem linux )



Answered By - SKos
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing