I'm getting started with a side project that will be developed using PHP and I'm looking for guidance on getting my Windows machine up and running and ready for development (as quickly as possible). Being that PHP development is more geared towards Linux users/developers (which I am not), I'm trying to figure out how to get all the pieces in place to get a 'WAMP' stack operational locally on my Windows machine.
Any good tutorials/quick start guides out there and if not, does someone have all the steps that they could provide me with here?
Install Apache Friends XAMPP.
PHP on Windows:
Install Xampp because it is really easy to install.
Use version control system like for example git to store your code.
Use an IDE like netbeans/eclipse/aptana for faster PHP development(autocomplete, code formatting, PHPdoc, etc).
Learn a PHP framework like for example codeigniter to ease your development. The video/screencast to create a blog in 20 minutes will learn you how to use it.
Practice TDD to test your code, which will result in more stable code-base.
Good luck coding!
Learning Linux/Ubuntu:
As a sidenote when installing ubuntu which is really a straight forward process you will see that using linux isn't that difficult as you think(It used to be difficult compiling source manually etc). when you install a dual boot and play with every day. I guarantee you that in no time you will really love linux like I do. I really think linux is the best option for coding. Also redis main creator shares this opinion with me.
Probably the quickest way to get a PHP server up and running on Windows is WAMP 2.0. Wamp Site. I use it on my Vista machine. Download it, run the 'exe', and start coding. It is only 16 MB but it is powerful and very simple to use.
Why not go the official Microsoft route:
Microsoft Web Platform Installer 2.0
installs both PHP (to run in IIS) and MySQL.
My two cents. I use Netbeans for my windows PHP development. Here is a quick start guide
As previously mentioned, XAMPP is probably the easiest and fastest way to get started with PHP. Search installing xampp on youtube, they got a good video on how to install it to your system.
Related
I understand LAMP, MAMP and XAMP are solution stack. I also understand there are frameworks like Laravel and Symfony.
If I have to start PHP development in a proper manner, Is it required to have a solution stack installed first and then the framework to have a professional set up?
If the answer is yes, then I am assuming the versions of the software inside the package is quite important for compatibility with the framework. Is there a popular combination out there?
And In Live, I suppose, I just to need to have the solution stack installed for the package to run.
My dev machine is a MAC with OSX 10.9.5 and my Live is going to be in Linux. I need to make sure these fundamental knowledge is concrete before I start the work. Any help is much appreciated.
Laravel has a all-in one virtual box solution. It's called as Homestead. Homestead works on many platforms such as Linux, MAC, Windows and contains everything you needed:
Ubuntu 14.04
PHP 5.6
HHVM
Nginx
MySQL
Postgres
Node (With Bower, Grunt, and Gulp)
Redis
Memcached
Beanstalkd
Laravel Envoy
Blackfire Profiler
If you decide to go with other solutions you will probably face with many problems like enabling essential extensions and with changing some system settings.
Besides you can use this solution for pretty much every kind of php framework or code.
Just follow the steps in the guide and almost everything will be ready to use just in few minutes after download finishes.
Laravel is good choice as there is big community and Google trends show it is growing very fast.
As it is PHP then you need to have server which processes the PHP. Usually it is Apache2.
Many people like to use MAMP, XAMP to simplify their development. I prefer to use standard Apache2 myself and you can even just rely on Laravel/PHP builtin server that you can start with php artisan serve, It will be enough for defelopment purposes.
Me and two friends want to build something in common in PHP, probably all of us are going to use eclipse for that, but some use Ubuntu and some use Windows.
Is there any convince and good why to share the code and develop together freely? Thanks!
And we don't want our project to be open source in this case :(
You can probably use a Subversion (SVN) or Git repository. These are tools that enable several developers to work on the same project at the same time, managing conflicts and versions of the code.
For free solutions, please see:
https://stackoverflow.com/questions/59791/free-online-private-svn-repositories
https://stackoverflow.com/questions/2378120/is-there-a-free-private-git-repository
How to install Subversive, a free Subversion client for eclipse: http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php
Depending on your platform, i would recommend following:
SVN Provider:
SpringLoops (Ref. Link)
I've been with them for 2.5 years now, blazing fast support. It has some rock-solid features like auto remote deployment so if you commit it instantly deploys to the remote server so you have the actual version running on the FTP too.
As far as i can tell you, KEEP AWAY from BeanStalk as provider, they are copying SpringLoops and have roughly the same features but theirs work very very slow. There are waiting times for remote deploy of 120 seconds in average.
Mac OS X:
I've extensively used Versionsapp from Sofa but in the last 2 years it did not receive any (major) update at all so i purchased CornerStone and it's working very very good. You can keep track of anything that happens to the repository.
Windows:
If you are using windows, i would work with tortoisesvn which works with the windows Shell so you give the commands via the shell menu. It's easy to use and is developed since a very long time.
If you have any questions write a comment and I'll update my answer :)
I think bitbucket is a great solution for sharing a small project with your friends and make it privately for free.
https://bitbucket.org/
I want to develop a professional website using PHP and MySQL. Can i do it in Windows 7 (64-bit) or i need to install linux based OS. How to go for it.
You can run an AMP Stack (Apache, mySQL, PHP) on Windows no problem. I have been doing this for ten years now. Running on Windows 7 64-bit is also no problem.
There are several pre-packaged installers available. My favourite is XAMPP. They usually allow full customization where needed.
You can also download the stand-alone binaries of each product and install them manually. Makes for very, very good learning but is more work.
Yes, you can.
Though a platform is the least thing you will need...
As mentioned it is possible to develop Php and MySQL sites quite happily on Windows using something like XAMPP, even if they are later to be deployed on a Linux web server and I know a lot of people do this and it works great for them.
However I have found in the past you can run into problems later on this way. For example, a lot of people who have only used Windows in the past can get caught out by case-sensitivity in Linux. So your site runs great locally but then you start getting lots of 404 errors when you go live because for example, mypage.php is not the same as myPage.php any more.
At the other end of the development spectrum, you can achieve some really powerful functionality when you start to work the server a bit more - things like video encoding or audio conversion are possible using PHP (with a bit of help from some other apps) on both Windows and Linux but the ways that you would do it are different therefore your development environment becomes much less useful and again you run the risk of putting something live that doesn't work, even tho it runs fine when you test it locally.
Personally, I think it is always best to develop on as close an environment to the intended production server as you can to avoid any nasty surprises when you go live.
Develop on the same platform you are going to be deploying to (if possible). It'll make it extremely easy to deploy with less room for possible error.
Installing the 64-bit versions Apache/PHP/MySQL on Windows 7 is a bit of a pain, but you can easily install the 32-bit versions using XAMPP (as mentioned by Pekka) from apachefriends.org
For Windows you can use a light package, which content php, apache, mysql, pear. link text
I want to do a sample program in PHP on Windows XP.
Do I need any special software to get this to work?
I am afraid that I simply open notepad type the PHP program and save it with php extension. Then I open it with the browser as a HTML file. But it does not work.
Please help
Thanks in advance
However you decide to install a webserver and php (or just php and use it in the console like someone mentioned):
Check out the PHP Manual, especially the Getting Started section.
Apache (Very, very easy)
Check out the WampServer getting started presentation.
Download and install WampServer.
And you are ready to go.
Microsoft (Not tested this myself)
Check out PHP on Windows.
Download and install the Microsoft Web Platform Installer.
Let me know how that work out... (never tried it myself, since WampServer is so easy)
You need to have a web server with PHP installed on your PC to make this work.
I highly recommend installing wampserver on your computer. It is a Windows installer that will put PHP, MySQL and Apache in your computer and let you manage all the services and such very easily. If you have problems getting it to work, you can also try out XAMPP, although I've never used it myself.
Some answers containing the hint for using wamp.
You should better use the Zend Server Community Edition.
This is also free and can be downloaded here:
http://www.zend.com/de/community/zend-server-ce
This contains Apache, Mysql, PHP and some Zend related Tools.
Benefit: its much better preconfigured than wamp.
Another easy one to set up (though it takes extra config to support PHP5) is easyPHP
you can simply install PHP, and then run the program and redirect the output
php foo.php > output.html
and then use any browser to open up that html file.
Since you have IIS on the windows cd I would suggest you go to control panel, install/uninstall programs and click on windows components and install IIS. Then install ASP.NET 3.5 from www.asp.net and finally install Phalanger from http://www.php-compiler.net/
That will give you the benefit of both worlds, you can program in ASP.NET using PHP as the language, you can use only PHP if you prefer that or you can mix using ASP.NET/C# on some pages and PHP on other pages within the same application.
I use XAMPP, works out of the box with his installer and is more than enough for a simple developer windows environment.
The simplest way - use www.microsoft.com/web platform installer. get the whole stack to run PHP all from one place.
i would like to share that before starting PHP we have to set environment for that and then we can start working with PHP.
http://code.freefeast.info/php-tutorials/setting-up-the-environment-for-php-php-tutorial/
In few months I start a project in PHP and I am hesitating to do like usual : develop on my Windows Vista 64bits machine. Since I know few things on Linux, I think it can be a good way to learn by working on a Linux distribution.
Do you think it's a good idea or not? I would run a VirtualBox with Ubuntu (on my Vista64bits). I was thinking to install XAMPP to be able to develop in PHP.
If you think it's a good idea, feel free to suggest me some tutorial about what I should know with Virtualizing an OS, or Linux/dev.
Update
I have build many website in PHP with Windows, the question is more about if it's a good way to start learning Linux by developing on it via a Virtual machine? I have 4 gigs rams, will it be smooth if I install Eclipse in the Virtual Machine? etc.
You should really develop on the same platform where you are going to deploy. I'm not saying it is bad to do differently, but it can save you some pain in the long run. OTOH, you might learn faster about platform differences that way. So, the main question is: do you want to have a production system running ASAP without much headache? Or, you want to spend some time and make some effort to learn how to develop cross-platform stuff?
And yes, there are differences. For example, case sensitive and case in-sensitive filenames. Then, some PHP functions use native C functions that have different implementation. For example, printf() does not produce the same amount of whitespace for some of the types. Resolution of time measurement (milliseconds vs microseconds) can be different, etc. Then, you have different ways filesystem permissions are handled. These are just some recent problems I've found that I can remember off the top of my head.
PHP should be the same on any platform - so where you develop shouldn't matter.
However, in my experience and observation,more sites running PHP are running on Linux than Windows.
Getting Apache and PHP setup on something like Ubuntu or Fedora is a cinch, and testing everything is pretty simple, too.
Also, when you go live with your site, what platform will it be running on? I prefer to do development on the platform it will be running on whenever possible.
Personally, I don't think that for local production you should be using a VM. Would you be running your IDE inside the VM too?
If you are aware enough of the pitfalls of moving between Windows and Linux environments (such as case sensitivity and permissions), you should have no problem developing on Windows and deploying on Linux.
Working on a Linux distribution is defnitely the easiest way to learn it. And setting up some servers and doing some dev work is an excellent start.
Virtualising Linux is also really easy. I've done it quite a few times and it's really obious. Also, going this way will ease you into using Linux, much better than just jumping in and finding out your wireless card is unsupported like I did :)
As for PHP development on Linux... I've done some PHP coding on Windows and on Linux and I can tell you there's very little difference between the two. I use Eclipse on both platforms and Apache &MySQL / XAMPP. The only major difference I've seen is that Linux is much more finicky about permissions and case.
PHP is not the same on all platforms, and until very recently the windows versions had problems which were not found in the Linux versions. Lots of useful features are *nix specific.
I would echo #Milan's sentiments about developing in the deployment environment. You learn a lot more about the deployment environment by doing so too.
On the VM issue, if you want all your Windows tools and your windows machine, setup a linux server in your VM (can have a GUI if you want, but you're going to mainly use it as a server). Set it up so that windows can view the apache install running in your VM and you use samba shares to access the vm's files like a drive in windows. That way, you develop in windows but are testing deploy / setup on a running linux server. While two devs at my shop run Ubuntu, a third needs to use Photoshop and various other bits of windows software all the time, so she uses this method of running a server in a VM but developing from windows.
Oh, and if you're running on Linux, don't use XAMPP! A few simple commands will have you up and running and you'll get a much better understanding of your deploy. XAMPP is fine, but it's for OS's that don't have Linux's package management.
while XAMPP works great, running Apache and PHP on Linux is a given; while on Windows it's something extra you have to do... and support. Also, most parts of the stack are far more optimised and mature for a POSIX environment. The database engine(s) performance is particularly sensitive to the available primitives.
Most OSS runs on windows, but it's a round peg whammed on a square hole.
On principle, I would advise against "learning by doing" in a real project - unless it it really small, or you have doen very similar projects before, so that the learning curve on project related issues would not be steep. In that case you may have ressources free for learning about the developing environment.
Generally I like the Linux environment better than Windows. Mainly because all the CLI tools you would need are provided and Bash beats cmd.ext any time. But with Cygwin I find even Windows a comfortable development environment.
Regarding PHP development I can't really see how it would be much different. Maybe there is some benefit in being forced to make the code more portable (things like line endings, forward slashes in filenames and such) if you use booth systems.
As a desktop or workstation there isn't much difference between the two. I find that the biggest differences lies in how you administer them, but hopefullt you have some other people doing that for you.
In my opinion you needn't to develop in a linux distribution.
Web Development can be done from any OS. I don't know, why you are programming for the web... as a professional? for your personal homepage?
I think, it's enough to get some free webspace running a PHP Server and to upload your files there... it doesn't take you much time and there are less things to manage.
a german student ;)
Use the OS your deployment server will be running, and it is highly probable to be linux. I have recently seen a deployment gone ultra bad cuz it was developed using wampserver and deployed on CentOS. With major differences in apache and PHP config. So know your deployment server and match it as closely as possible.
Try creating a development environment using VmWare Player. I have several Linux environments that I run on my Vista laptop. You could also just dual boot. I use Ubuntu, it is easy.
The side effect of developing inside a VM: more overhead and eventually the needs of additional tools to make the development more comfortable.
Often people need special tools for their development like Photoshop or some vector design tools not available on Linux. If the working copy of the project is inside the VM, it makes sense to have easy access to it. So you will setup SAMBA (which makes often problems with the login from XP) or setup SSL(SFTP)/FTP.
Also you must learn how to use networking with the VM (NAT, bridging, port forwarding).
On the other side, developing on another platform as the target can give some headache. I found myself often confused with .htaccess files for password protection, because oft the different path on Windows/Linux. If you forget to change this entries later on the production server, you have a problem...
A better solution: use the best of both worlds.
A VM eventually running later headless (no gui, more like a "remote server") with Ubuntu/Debian/FreeBSD) and only running the needed servers (Apache, MySQL, FTP, SSH...).
Eclipse or the other development tools on Windows/Mac.
5 years later: My opinion is to use the Linux solution. There are many advantages for using PHP in Linux. The primary reason is the level of help available from the community. PHP seems to be optimized for Linux environments as well.
There is also safety in numbers as an overwhelming number of sites are hosted and run with LAMP solutions. There are a wide range of frameworks and CMS' that run best on Linux with Apache2.
Make your life easier and start learning PHP straight away.