Executing PHP Scripts on bluehost.com

PHP + bluehost.com

If you’re stumbling upon this post, it means you’re probably trying to execute a PHP script on your bluehost shared account via ssh and you’re getting the following message:

Content-type: text/html

And sometimes your script might execute properly and sometimes you’ll get some message about a 500 error.  If this sounds like you, there is a simple solution, use the following:

user@your_site.com [~/public_html]# php-cli yourscript.php

You were probably executing “php yourscript.php” which on bluehost defaults to processing the script as a webpage which is why you’re getting the header information “Content-type: text/html”.  By using php-cli, you’re telling PHP to run the script as a command line script.  I hope this helps someone.