How can I run a PHP website offline?

Hey everyone,

I am pretty new to this so excuse me in advance for my ignorance, I may be missing basic stuff. I have a folder on my computer that contains a ready complete php site, and my goal in life is to be able to first view and then edit it offline.

I tried to look for a solution online for a long time, and from what I read you need MySQL, PHP, and Apache in order to do that. So I’ve downloaded WAMP that contains all three and tried to run the website through localhost after copying the folder to it’s destination in the WAMP folder. But it did not work just like a wrong internet address.

I’ve also tried to open it with DreamWeaver but only saw the code itself with no ability to see the sites and it’s functions.

I would also like to upload it to a GoDaddy account I have but that’s later.

Thanks in advance

First you have to start your Apache Server and MySQL (If you are using a database), this is usually done with a control panel application (I run XAMPP, so I don’t know exactly what it is). Then you have to point your webpage to the right URL - for example mine is http://localhost/php_sandbox/uasort.php there is a folder in wampp that your files will have to be in and I pretty sure some kind of documentation or even doing a internet search will tell you where the folder is. To get Dreamweaver to pull it up the page up automatically you’re going to have to set that up in Dreamweaver and again online search can help you out there.

First thanks for the answer.

I’ve since my post deleted WAMP and replaced it with XAMPP. I read and found that that folder you were talking about is “htdocs” which is located in the “xampp” folder, so I put the folder that contains my website in “htdocs” and tried to go to “http://localhost/site/index.php” but it says “Object not found!”. I made sure it is spelled correctly and did this while XAMPP is running and all the applications there are activated.

  • Edit: I tried to enter the folder and not the php file itself (entered “http://localhost/site”) but this message appeared: “Error establishing a database connection”.

Any ideas?
Thanks again, Sinai

You have both Apache and MySQL running (Highlighted Green)? Special note they recommend run the XAMPP Control as an administrator (Right click and open as administrator or something like that).

Under htdocs what I do is have folders and in those folders I have the files (you need to open the files not the folder).

You also need to run phpmyadmin (Admin button in XAMPP Control Panel), if you’re going to use a database in order to set it up.

Is this for a CMS? If so, have you created the database for it to use, have you added the connection settings to the config file? ( and started MYSQL)

In Windows, install XAMPP or WAMP
Which are Windows Apache Mysql and Php bundles

In Linux install LAMP
Which is a Linux Apache Mysql and Php bundle

Both of which could help

Cheers,

Sponsor our Newsletter | Privacy Policy | Terms of Service