Using PHP with Windows - php

I recently inherited a PHP Web Site to maintain. My knowledge is in ASP.Net and HTML. I need help getting started.
I downloaded WAMPServer. It installed ok, but it doesn't run. I try to run it and it just exits. No error message.
I am running Windows 7.

As you've seen, you probably want to consider XAMPP here http://www.apachefriends.org/en/xampp-windows.html. There is a portable version in there that I highly recommend. It requires no installation, so it just always seems to run, even when you've had trouble with other setups.
It also has the ability to set things up so they DO run as services, but I'd suggest if you're just getting started, don't clutter up your registry until you get into it a bit and figure out if you really need it installed.

Related

Ubuntu server 11.10 and PHP 5.2 for use with Drupal 6

I'm trying to figure something out:
I am using Ubuntu server 11.10 virtualized on Win7 (I don't think that matters but more info is better than less) to work on a Drupal 6 website I inherited and need to make significant changes to.
I want to set up a development copy of this Drupal website on my Ubuntu server so I can work without worrying about torching the production website.
I successfully got the production files downloaded and onto my machine, I got the production MySQL database exported and imported into the dev MySQL server, and I set up a symbolic link from the directory /home/myname/thewebsite.com to /var/www/thewebsite.com so I can easily access it.
When I got the website they didn't know the admin password so I dug around online and reset it in the dev db using phpmyadmin and finally log in.
When logging in and poking around the site there are lots of errors, which when googled lead me to believe that PHP 5.3 is causing them and that there are some modules in use that only work with PHP 5.2
After looking around a lot online and on stackoverflow there seems to be no easy way to install PHP 5.2 on Ubuntu Server 11.10. With no packages for 5.2 available through apt-get or aptitude what should/can I do?
1) Install 5.2 from source - how do I get it to interface with MySQL and Apache2? Also, I've never installed anything significant from source. Is there a walkthrough?
2) Replace the repositories with old ones? Will this work on 11.10? The newest instructions I found were for 10.04
3) Use already built PHP 5.2 packages for Ubuntu? Couldn't find these
4) Pay someone who knows more to do it for me? (Just kidding, this isn't really an option...)
Cheers and thanks for your help!
PHP dropped support for 5.2 in August 2011; operating system providers such as Ubuntu will not supply a version that is out of support, so you absolutely won't get an official copy of PHP 5.2 on the current version of Ubuntu (or any other OS).
If you're running an older version of Ubuntu (eg 10.04), you might be able to do it; it would still be a downgrade, because PHP 5.3 has been the default version for quite a long time now.
If you're on a newer version of Ubuntu, ie 11.10 as you state, it is going to be a problem for you.
The Drupal developers dropped the ball badly on this one. I guess it was because Drupal 7 tool so long to finish; they were expecting D7 to be out much sooner, and so they never bothered fixing up D6 to work with PHP5.3. As it turned out, this was a big mistake, because in fact D7 still wasn't officially released when PHP dropped support for 5.2.
But even so, they should have fixed it, because they're still officially supporting Drupal 6, so they need it to work with the current version of PHP. This is definitely Drupal's problem, not PHP's, Ubuntu's or yours.
But you still need to deal with it.
I found this question over on AskUbuntu.com, which gives an answer applicable to 11.04. It isn't quite 11.10 you were asking for, but it it a lot more recent than the best you'd found, so it might be helpful.
Alternatively, you could research exactly what it is about Drupal6 and your specific modules that doesn't work in PHP5.3. The language differences between 5.2 and 5.3 that can break things are not big, so I would expect any code changes required to be fairly small. You might find you can fix the code yourself. And maybe even submit the changes to the community -- Drupal is open source, after all.
Another tack you could take is to consider whether this saga represents an opportunity for you to move the site to Drupal 7?
This may or may not be feasible, depending on the modules you're using, etc, but if it is possible, it will solve the problem, because D7 is of course fully compatible with PHP5.3.
And just to cheer you up, I'll close by mentioning that PHP are on the verge of releasing PHP 5.4. Hopefully the Drupal devs will be more on the ball this time.

Using Mamp or another package vs manually enabling PHP and installing MySQL on Mac 10.6

What are the benefits of installing mamp or another package vs enabling php in httpd.conf and manually installing mysql? I am really not sure of which option is better and would love some info.
Thanks,
MAMP and other packages are usually pre-configured and come with other tools like phpMyAdmin, SQLite Manager, SSL, code optimizers. If you think you're handy enough to do what others have done, go ahead. But it'll save you a lot of time and trouble by grabbing what's already available.
I've used MAMP for over two years now and I love it.
For me, I didn't want to configure PHP and MySQL with Apache. On my old computer I installed MySQL and then phpMyAdmin and had a lot of fun trying to get it all working. (But I'm not good with terminal and bash commands)
I installed MAMP on my new computer just because it does all the work for me. When I want to debug a php script, I just fire up my local server and make a few changes.
Imo, MAMP/WAMP = Easy get up and go in a development environment.
If you are running a business critical app, you may be better off with a LAMP stack

Using PHP and MySQL to develop website

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

Getting started with PHP on Windows

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.

What do I need to run PHP applications on IIS?

Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for IIS on windows.
Make sure you get the FastCGI extension for IIS 6.0 or IIS 7.0. It is the single most important thing you can have when running PHP under IIS. Also this article should get you setup:
http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/
Everything beyond this is simple, MySQL and what not.
We just rolled out PHP 5.2.6 + FastCGI on our shared hosting platform without any problems. As long as you follow the steps outlined in the article Nick linked to then you should be just fine.
My only additional piece of advice would be to forget about using the fcgiconfig.js script to modify the fcgiext.ini file, it's more of a hindrance than a help. Just edit it by hand, you also learn more about how it works.
If you're installing PHP onto IIS 7 then this link should be worth a read though:
Using FastCGI to Host PHP Applications on IIS 7
#pix0r
That actually annoyed the hell out of me too and nothing came close to Apache mod_rewrite. Because they all have this overly complex XML structure. So I actually took the time and wrote my own rewriter for IIS 6.0 and IIS 7.0. Non-.NET applications only works in IIS 7.0.
http://www.managedfusion.com/products/url-rewriter/
http://www.codeplex.com/urlrewriter
One of the major sticking points I've had with IIS is the lack of Apache's mod_rewrite. There are other work-arounds and work-alikes depending on what you're doing, but just keep in mind that you'll need to change things up a bit to work with IIS if you're using mod rewrite extensively.
Since you're moving from LAMP (a somewhat cool acronym) to WIMP (a less cool one), you may need to mentally affirm yourself. Otherwise, I've had very little trouble with PHP on Windows.
ISAPI rewrite (http://www.isapirewrite.com/) is $99 and has worked very well for me for URL rewriting.
Why not go with Apache on Windows?
If your using iis 7 keep an eye on this project, http://phpmanager.codeplex.com/.

Categories