Monday, June 29, 2009

Think Locally, Act Locally - Setting up a PHP Development Server

Day 1 on my brand-new project, a PHP/MySQL site. I'm hoping to post here about all of my mistakes and how I solved them, so that others can benefit from my ignorance.

The first thing I needed to do was to set up a local testing environment, so that I can create a database on my very own hard drive, write PHP pages, and test them with a web server.

Turns out that there are 493 ways that this can be done, and a simple Google search reveals that each one has at least 19 tutorials on the Internet. You do the math, because at that point I decided to look for the simplest solution. The one I came up with is called WAMP Server, which is for Windows. That's what the W is for. Windows, Apache, MySQL, PHP. It has all of them bundled together, a bundle of joy.

So I installed that. The only real problem I had with it was this: it didn't work. So I went and bothered everybody on my favorite web development forums, and they told me that (in my case) Skype was taking the port that WAMP needed. I don't really know what a port on a computer is, but it's some kind of a door-like thing, an opening through which things pass. I had to change a setting in Skype before WAMP would work. The setting in Skype was under Options > Advanced > Connections - I had to un-check "Use port 80 and 443 as alternatives for incoming connections". Apparently this lets Skype choose any port it wants. So if WAMP is running, Skype will still get a port that makes it happy.

So, now I have a PHP development environment.

Next, I needed to set up Dreamweaver, which is my homeboy that I use for everything, and I don't care what all the haters say. That involved creating a Site Definition, which I've done 3,057 times before, so I'm not about to describe all the details. The important parts are the paths - the one under Local Info where you tell Dreamweaver physically where on your hard drive the files are, and then the two paths under the Testing Server tab.

Now, for some reason, I thought that the root of my new local web server was at c:/wamp/bin/apache/apache2.2.11/htdocs. But it's not. It's at c:/wamp/www.

So, I'm putting my site files at c:/wamp/www in a folder named after the site, northeastlooms*, in a subfolder called site. So the physical path to my site root is: c:/wamp/www/northeastlooms/site. That path is what goes in "Local Info/Local Root Folder" and also on the Testing Server tab in the Testing Server Folder field. Under URL Prefix goes http://localhost/northeastlooms/site/. If you look at those two different paths, you can see the relationship between them. http://localhost points to whatever is in the local server root - in my case, that's a folder called northeastlooms containing a folder called site, containing the files for my web site.

And I don't even have a web site yet. But there you have it, that's my PHP Development Environment.

This video tutorial by David Powers, Defining a PHP Site, was helpful and so was this article on Adobe.com: Setting up a PHP development environment for Dreamweaver.

* Names have been changed to protect the innocent.

Labels: , , ,

Friday, June 26, 2009

WordPress Emergency Password Reset Script

Last night, I carefully changed the password to one of my WordPress blogs. Like I said, I did it carefully, and then noted the new password in the place where I note them, which of course I'm not going to tell you.

I then tested the new logins, and they worked fine.

So imagine my surprise when I went to log in this morning, and it didn't work. Neither of the logins I have for that WordPress installation worked. I tried old passwords, various passwords - nada.

There's a "Lost Password?" link on the login screen, so I clicked it, expecting an easy solution. I entered my email address and submitted it, only to get an error message saying something about my host company not enabling Send Mail. What the hell? So I don't get any emails from WordPress? Better look into that.

Meanwhile, I couldn't get in! I went to the WordPress documentation and searched. One solution had me using phpMyAdmin to access the database directly. Ok, fine, it might come to that, but isn't there an easier way?

Thankfully I say it: ("thankfully" describes my feelings, not the grammatical clause which comes next, so it makes no sense to just write "thankfully") there's a nice little WordPress Emergency Password Recovery script that solved my problem very quickly. It involved downloading a zip file, uploading a single .php file to the server, pointing my browser to it, and filling out the form there. And it worked! Thank you, village-idiot.org. I guess I was the idiot in this case (what else is new?), though I still don't know how it happened.

Labels: ,

Thursday, June 25, 2009

My PHP/MySQL Adventure

I'm about to start a new project, a database-driven site. I've done a few before, always in ColdFusion and MS Access, but it's been a few years, and in 2009 I think PHP and MySQL is the way to go. If I'm going to spend time slaving over a hot laptop (and believe me, when you're working in the Yucatan in Mexico in summer, that's no exaggeration!) I want to be gaining PHP/MySQL skills, not ColdFusion/MS Access.

So, planning to blog here as I go along, and share what I learn, and my tears and triumphs!

I still don't quite have a grip on MySQL. Unlike MS Access, there isn't a convenient program sitting on my laptop already for creating and editing databases. Instead, apparently you have a number of other options, some free, some which cost:

PHPMyAdmin
Navicat
My SQL Administrator
MySQL-Front
Heidi SQL
SQLYog

Scary-sounding, aren't they? Couldn't they be more Web 2.0-friendly-birds-and-clouds about it?

A good discussion on my friend's NNTP forum (news://news.gowest.com/gowest.webdev) produced the following nuggets of information:

Re. Navicat: "Even for a single project it will make your mySQL life SO much easier. There is even a free 'light' version, and a 30 day full featured trial on the regular mySQL version that most of us use ($99 to buy a license after 30 days and well worth it). I can't imagine doing mySQL at all without navicat. Makes phpMyAdmin look like an old dog in a horse race... no comparison!" - Michael Evangelista, GoWest Web Design and Hosting

"...worth its weight in gold - i couldnt agree more, found it a few years ago and it beats all other tools hands down." - Twocans

"I would not know where to begin using MySQL without Navicat and would not even try. I bought the $99 version after using it for 2 days six years ago, have never regretted it, completely agree with Michael here." - LWD

"I've been using Navicat for donkey's years and love it, but I think unless you're going to be working with MySQL on many projects it wouldn't be worth the expense. phpMyAdmin is perfectly adequate (free) but if you want a GUI then there is MySQL Administrator 1.2 from http://dev.mysql.com/downloads/gui-tools/5.0.html which is also free. MySQL-Front is an old favourite too (http://www.mysqlfront.de/) - it used to be free but now I see it is US$35 - still, it's good value." - Steve Fleischer

"Take a look at Heidi SQL. This is the continuation of the old MySQL Front project and uses the same GUI if you are familiar with that one. It is also freeware.

http://www.heidisql.com/

I've used it since the first project (MySQL Front) was started. If you have minimal requirements (i.e. just working with a single development MySQL database on your local computer) it is all you would ever need (it also remotely interfaces to any online MySQL database too).

You may also want to look at what your web host offers. Most have PHPmyAdmin installed which is more than enough for 99% of all remote database nuts N bolts stuff.

Now having said all of this, I use Navicat standard because I have to interface with several databases on my DB server and it allows me to log in as root admin and do anything I need to do for clients. Navicat is nice if you need it or if you just want something super slick to play around in. I do not have Oracle or PostgreSQL installed on my DB server so I would not need to upgrade to their premium product.

You can still find the last freeware version of MySQL Front (2.5) if you Google enough for it but Heidi has moved forward from that last freeware version so you might as well download the latest offering from the original MySQL Front developers." - Mike

"If you're doing much of anything with a MySQL db I second the vote to get, or at least try, Navicat. If you're used MyPHPAdmin at all, it will open your eyes and make you wonder why anyone would want to use MyPHPAdmin ever again." - Mad Dog

"Navicat is pretty, and it's easy to use, but it falls down terribly when testing SQL queries. phpMyAdmin isn't at all pretty, but it's easy to use, and it handles SQL queries that make Navicat barf. I must admit that I haven't used Navicat a great deal, but I can't find a great deal to get excited about." David Powers, www.foundationphp.com

"Or you can try SQLYog (http://www.webyog.com) - another excellent MySQL admin tool. I am not sure how it compares to Navicat now, but when I switched from phpMyAdmin it was beating Navicat on many fronts. The free version has a nag screen on startup and shutdown, and does not allow connections to remote hosts + of course none of the true enterprise features. $99 for a full Enterprise version seems very reasonable." - Azadi

"SqlYog is similar to Navicat, but has one HUGE advantage. SqlYog offers a php page you can upload to a site so that you can tunnel to MySQL on shared hosts that don't allow a direct connection. If you ever have to work with MySQL on a shared hosting account without any external ports open then SqlYOG is the only way to go. If you don't need this feature, then I think Navicat may be the winner but they are very similar in my experiance." - David

I'll let you all know which I end up settling with. I love the idea of a nice, easy interface, but I'm only doing this one small project and I'm living on pesos, so don't want to pay much.

Thursday, June 18, 2009

E-Junkie for Selling Digital Downloads

After using another digital download system for about six years, I just recently switched to E-Junkie, and I'm very pleased.

I had been using Payloadz.com since I first started selling my web business forms. Although the service generally worked well, complaints from customers that something malfunctioned were too frequent. More serious, to me, was the fact that as time went by, customer support went way downhill. Where initially I received fairly quick and cheerful responses from a real person, over time this turned into slower and slower responses, much more brief and less helpful, and they began to be unsigned, as if they came from a computer or a massive faceless corporation, which I actually knew was not the case. I found it difficult to carry on a support thread with someone who had no name.

These things bothered me. But I thought that the price I was paying - $70/month for about 30 downloads - was typical and reasonable. So imagine my surprise when I discovered that E-Junkie came very well-recommended, and that it would cost me $5/month for exactly, precisely the same service!

I was nervous about switching, but finally took the leap. So far, everything has been entirely smooth, no problems, no complaints from customers. To be fair, I haven't had much need for customer support yet, so that remains to be seen. My impression is that it will be pretty decent. But even if it's mediocre, I'm no worse off than before, plus I have $65 more in my pocket every single month.

Here's a list of features offered by E-Junkie - visit E-Junkie.com for more information. By the way, I am not affiliated in any way with the company other than being a customer.
  • Easy to use, centrally managed service
  • Digital storage & delivery for files & codes
  • Supports multiple payment processors
  • Copy-paste Buy Now and Shopping Cart buttons
  • Supports variants for tangible products
  • Shipping and packaging calculator
  • Sales tax and VAT calculator
  • Packaged products
  • Inventory management
  • Product promotion
  • Discount codes
  • Affiliate management
  • Autoresponder, updates & newsletters
  • Sales tracking, built in support for Google Analytics
  • Customization
  • Download link renewals
  • Easy integration with 3rd party and custom services
  • Logs & e-mail notifications
  • Globalized
I'll report in again a little further down the line when I've had more experience with them.

Labels: , ,

Tuesday, June 2, 2009

Actually, I can't recommend Foxit Reader

Ok, I have to renege on the recommendation in my last post. After testing out the PDF viewer Foxit for a few days, I found that it gave me trouble. There was one document I could not open at all with it, and I was a bit sorry I had set it to be my default PDF viewer, because it took me a while to figure out how to undo that setting. I'm back to using Adobe Reader.