Answer the question
In order to leave comments, you need to log in
How to run php script with plink or from bat file?
Good afternoon!
Actually, you need to run a php script on a remote site from a bat file. I'm trying to do it with plink. I do this:
test.bat :
plink.exe -ssh {userName}@{domainIP} -pw {passWord} -m commands.txt
pause
cd {folder1}
cd {folder2}
php test.php
Answer the question
In order to leave comments, you need to log in
If you connect via ssh to a remote server and execute these commands manually:
cd {folder1}
cd {folder2}
php test.php
what does it say?
Maybe php is not in PATH? Write the full path to the php binary, for example.
Perhaps the command is called differently. Or there is no php on the server at all.
Solved the problem by using wget instead of plink. Just one line is enough: I
add:
Thanks to Saboteur 's hint , it turned out to use plink as well . It was necessary to simply write the full path to php in the commans.txt file , that is, instead of doing it, php test.php
you can {Full}/{Path}/{To}/php test.php
find out the full path to php by connecting to the server using putty and executing the commandwhich php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question