Running PHP Scripts


#1

I am a newcomer to Dreamhost and have a very basic question. I attempted to run a simple PHP script by placing the script in my root directory, changing the permissions, and using the command

http://www.mydomain.com/test.php

The error message was “requested URL not found”.

I have searched the Dreamhost documentation and forum for some basic guidance to get started - but, wasn’t able to find anything on the basics.

Can anyone point me in the right direction? Any help would be greatly appreciated.

Thanks


#2

The problem probably stems from what you mean when you say your “root” directory.

In the DreamHost file system, your user’s “root” directory is “/home/yourusername”, and that is the directory you will find yourself in when logging in via FTP/SFTP. This directory is not web accessible.

Within that directory you will find directories named “yourdomain.tld” (by default), or whatever you selected when you “Added” the domain to the hosting system. Those directories are “web accessible”, and that is where you should put pages/scripts/etc. that you want to be able to reach on the web with a browser.

So, in order to be able to browse to “http://www.mydomain.com/test.php”, assuming you have added “mydomain.com” as a fully hosted domain in the Control Panel, you should place the “test.php” file in the “mydomain.com” directory beneath your user “root” directory, so that it “lives” in “/home/yourusername/mydomain.com/test.php”. :wink:

–rlparker