Reputation: 1160
I'm trying to run a script from my PHP file. When I run the script, it just opens my notepad instead of executing the file.
I have given my folder read and write permissions, tried to run via SSH (because I work with Vagrant) and via cmd. But nothing seems to work. I think my code is correct, which you can find bellow:
$output = shell_exec(getcwd()."/scripts/row.sh 2>&1");
Someone who can help me out?
Upvotes: 3
Views: 2977
Reputation: 20980
It's because your OPEN WITH
for .sh
files is set to notepad
.
Check below output:
my_prompt> assoc .sh
.sh=sh_auto_file
^ ^ ^ ^ ^ ^ ^ <~~~~~~ Remember this name
my_prompt> ftype sh_auto_file <~~~~~~~~~~Use it here
sh_auto_file=%SystemRoot%\system32\NOTEPAD.EXE %1
You can change the association with:
my_prompt> ftype sh_auto_file=c:\cygwin\bin\bash.exe %1 %*
(Change the path for bash.exe as per your setup...)
For more details, run commands assoc /?
& ftype /?
on cmd.exe
. (/?
is typical equivalent of -h
or --help
in Linux commands...)
Also, for more advanced users, check in registry for HKCR\.sh
& HKCR\sh_auto_file
.
You can use regedit
for it.
Upvotes: 4