matfish Posted September 1, 2009 Share Posted September 1, 2009 Hi, trying to run a .php script (on the same server) using a .sh script. I thought it was something like #!/bin/bash curl "http://www.domain.com/script.php" but it's saying "curl command not found" - but curl is on the server.. Mental blockage as I've done something similar before - any help? Many thanks Quote Link to comment Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 if your trying to execute a script on the same server use php's cli. #!/bin/bash /usr/bin/php /path/to/script.php If you really must execute the script via http, use wget. #!/bin/bash wget http://localhost/script.php Quote Link to comment Share on other sites More sharing options...
matfish Posted September 1, 2009 Author Share Posted September 1, 2009 Is there no other ways from the above? Quote Link to comment Share on other sites More sharing options...
matfish Posted September 1, 2009 Author Share Posted September 1, 2009 Im sure I used "curl username:password 'http://www.domain.com/script.php'" or something similar for when it was htacces password protected just to run the script and not download it with wget Quote Link to comment Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 There is different switches to wget just as there are different switches to curl. I was posting a simple example. You on the other hand where not giving us all the information needed to help you. Now I suggest you look up the man pages for wget and curl and go from there. Quote Link to comment Share on other sites More sharing options...
matfish Posted September 2, 2009 Author Share Posted September 2, 2009 No point in asking for help on here if we got to RTFM Quote Link to comment Share on other sites More sharing options...
trq Posted September 2, 2009 Share Posted September 2, 2009 Exactly. Quote Link to comment Share on other sites More sharing options...
cpace1983 Posted September 8, 2009 Share Posted September 8, 2009 Sounds like you aren't using the absolute path to curl. Try: /usr/bin/curl instead of just curl. The reason for this is since you just a shebang in your script, it isn't importing the PATH variable correctly. This will fix the "command not found" issue anyways- I'm not getting into whether curl or wget is the best way to do what you're trying to do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.