The Little Guy Posted March 2, 2009 Share Posted March 2, 2009 OK, so I am trying to run php using a python script, It isn't working for me.. Here is what I have: import commands root = 'C:\root' self.wfile.write(commands.getoutput('php ' + root + '\file.php')) And here is my error output: '{' is not recognized as an internal or external command, operable program or batch file. The php file that I am trying to execute looks like this: <html> <?php echo 'hello'; ?> </html> I don't see what is wrong... Link to comment https://forums.phpfreaks.com/topic/147656-command-line-php/ Share on other sites More sharing options...
trq Posted March 2, 2009 Share Posted March 2, 2009 You might want to use the full path to php's cli. Link to comment https://forums.phpfreaks.com/topic/147656-command-line-php/#findComment-775142 Share on other sites More sharing options...
The Little Guy Posted March 3, 2009 Author Share Posted March 3, 2009 I guess I may be using the wrong method to do this... import commands root = 'C:\root' self.wfile.write(os.system('php ' + root + '\file.php')) system works, but it prints it out to the screen, I would rather it return it as a string, any way to do that? Link to comment https://forums.phpfreaks.com/topic/147656-command-line-php/#findComment-775272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.