4
2011
Setting up a localhost PHP development environment
Before getting too far into posting tips and tricks for some of the more advanced functions and operations that can be completed using PHP, I thought it may be helpful to provide a bit of instruction on how to set up a simple, quick, easy localhost development environment for testing.
Preliminary disclosure: I am a Macintosh user, so instructions provided for setup on Windows are from third parties!
Using Macintosh:
For this setup, we’ll be using MAMP, an open source web development environment for Macintosh that allows simple, quick webserver installation and usage.
Start out by downloading MAMP from their website here, then run through their quick installer.
Once MAMP has been successfully installed on your computer, I’d recommend making a folder alias for quick access to your web files. This can be accomplished by navigating to your applications folder -> MAMP -> htdocs, then right-clicking on the htdocs folder and selecting “Make Alias”. You are then able to drag the alias of the htdocs folder anywhere you find convenient.
To get started, just start the MAMP application (if MAMP isn’t currently open, you’ll notice that your PHP files are not rendered in the browser, and you won’t be able to connect to your MySQL server).
Expecting more steps? Sorry! That’s it. You’re now set up and ready to start development. Just ensure that your files are located within the htdocs folders, and start making some beautiful websites!
Using Windows:
Again- disclaimer: I’m a macintosh user and have not used the WAMP development environment.
If you’re working on a PC which runs any form of the Windows operating system, you’ll be pleased to know that WAMP exists just for you, and is available here.
Follow the same steps from above, however- ensure that you have selected (at minimum) the most recent versions of PHP, MySQL, Apache, and PHP MyAdmin for installation to maintain compatibility.
Fin.
That’s it! As long as you’ve got your installation of MAMP or WAMP open and running, no problems (code notwithstanding) should exist, and you can quickly and easily begin your development project.
Related Posts
1 Comment + Add Comment
Leave a comment
Recent Snippets
- htaccess : Only allow access to specific wordpress upload types if logged in
- MySQL : Query WordPress Database for Invalid Media Filenames
- PHP : Get Actual IP Address with PHP
- JavaScript : Allow Tab in Textarea
- PHP : Clean sanitized database contents on output
- htaccess : Force www. prefix in URIs
- PHP : Force File Download with Correct Content Type
- Wordpress : Disable upgrade notification
Hi !
I was aimlessly wandering on the web when I found your blog, and this (pretty old but still valuable) article.
Just one huge precision for newbie developers that might end on this post :
Both Windows AND OSX use Case-Insensitive filesystems ! Take care, especially on Linux : if you have a file called File.php, a small require ‘file.php’ will work both on Windows and OSX, and will fail miserably on Linux, throwing you a fatal error that can takes ours to debug if you don’t remember this filesystem oddity…
This is also true for Mysql : if your table name is User, the request ‘select * from user;’ will work by default on OSX and Windows, but not on Linux.
Bye !