neginf Posted June 10, 2013 Share Posted June 10, 2013 New to PHP. A hello world program that prints "hello world" on a browser prints a blank line when run from command line. Have put PHP directory in path and .PHP in pathext. How do you get a PHP program to run from the command prompt ? Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/ Share on other sites More sharing options...
requinix Posted June 10, 2013 Share Posted June 10, 2013 What's the code for this script you're running? Exactly how are you running it? Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435193 Share on other sites More sharing options...
Solution rwhite35 Posted June 10, 2013 Solution Share Posted June 10, 2013 PHP file: test_php.php <?php echo "Hello World"; ?> from the command line prompt: yourname$ php test_php.php stndout: Hello World Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435224 Share on other sites More sharing options...
requinix Posted June 10, 2013 Share Posted June 10, 2013 A hello world program that prints "hello world" on a browser prints a blank line when run from command line.Ah, so you actually meant to say it prints "hello world" when run from the command line too. What's the problem? Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435233 Share on other sites More sharing options...
AbraCadaver Posted June 11, 2013 Share Posted June 11, 2013 Ah, so you actually meant to say it prints "hello world" when run from the command line too. What's the problem? Two different people Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435248 Share on other sites More sharing options...
requinix Posted June 11, 2013 Share Posted June 11, 2013 Two different people So it is Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435251 Share on other sites More sharing options...
neginf Posted June 11, 2013 Author Share Posted June 11, 2013 Helloworld.php was working right from a browser but just printing a blank line from the prompt. It had html in it, so took it out and also put "php" infront of "helloworld.php" at the prompt and then it worked. Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/279003-php-from-command-prompt/#findComment-1435376 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.