Setting up PHP


I’m new to web development and php.

I’m trying to setup a basic HelloWorld php script, and I’m having trouble with it.

  1. If I try executing a hello world script with a .php extension, it works. If I try with .cgi execution, I get a 500 internal server error. I’ve configured dreamhost per the wiki ( and ), but still no luck.
  2. Can i include php scripts in regular .html (or *.*html files)? Ideally, I’d like to create regular html files and add scripts wherever necessary.

Here’s the source in the file:

<?php echo "Hello, world!"; ?>




You have to use a per-directory configuration file (.htaccess) to have either the web server execute .cgi files as PHP or re-write the URL.

Nope - DreamHost doesn’t support mod_php anymore. Additionally it will slow performance if you have PHP parse every file whether or not it has PHP code in it.

:cool: -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


Thanks Atropos7.

I created a .htaccess file in my cgi-bin directory with the following syntax:

<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-script

No luck. I also tried

Options ExecCGI

Still got a 500 server error. Any thoughts?