Jump to content

localhost


TheCatapult

Recommended Posts

Hi, I would like to ask if it is possible for me to activate PHP in my own machine. I have to upload all of my files in my web host just to see if the PHP scripts are functioning. I'm tired of it. Is it possible to activate PHP in my own machine as well as MySQL? Thanks!

Link to comment
Share on other sites

Yes it is possible, but I found it is better to develop on the web host because their settings or version may vary from what you have on your machine and this can cause problems. For instance, I wrote an algorithm to encypt saved data that used a timestamp from the data's record. Worked good on my machine, then when I merged it all onto my webhost, the encryption/decryption algorithm didn't work with pre-encrypted data because of locale differences. It was really my fault for not writing an algorithm that checked for that, but it was a pain none the less. I use a plugin for Firefox called FireFTP. You can make a profile to log into your webhost FTP, into the directory your website is in and then associate your favourite code editing program (I use Notepad++) to your PHP/CSS/HTML files. You can open your files directly from the web host, edit them locally on your machine and when you save them or exit the editor FireFTP uploads them ready to use.

Link to comment
Share on other sites

There are usually ways around this, and it could be as simple as changing a value in a config file or something similar when going from "dev" to "production". I personally test locally first for all my development, and then upload to a beta directory or stage subdomain and test there. It would drive me crazy to have to FTP a file a bunch of times just to test some looping and output. If the host is that far behind something like WAMP/MAMP, then I would recommend getting a better host.

Link to comment
Share on other sites

That's the beauty of FireFTP. you just edit your file and save it like you would locally. FireFTP recognizes when it's changed and uploads it automatically. By the time you've changed window to the browser to test it, it's uploaded.

Link to comment
Share on other sites

Personally, I like to code off the stage/production environments unless I'm ready to put it there. i.e. ready for production ready testing and eventual deployment. Plus I favor using VC systems, so having the all work done locally allows me to keep the VC history locally and to use all the various/respective VC features. That's just my preferred work flow, and more or less how we do it at work. If you flow works for your you, that's great. I just feel that the advantages of developing locally outweigh the benefit of working off the server directly.

Edited by thescientist
Link to comment
Share on other sites

By the time you've changed window to the browser to test it, it's uploaded.
Unless you have a slow internet connection. It may take a while to upload even smaller files. Working locally, there is no delay regardless of your connection speed or if you even have a connection at all. Also, in my mind at least, there is the concern about buggy code. Say you write a snippet that contains an infinite loop or a memory leak (it happens to even the best of us...) If you upload and test that on your host, you could run the risk of crashing their server. Personally, I'd rather crash my own server, than someone else's.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...