Database-driven web sites using using Linux, Apache, MySQL, PHP, etc?
December 10, 2004 5:25 PM   Subscribe

I know how to make database-driven web sites using Windows servers, Access, IIS, and ASP.

I want to learn how to do the same using Linux, Apache, MySQL, PHP, and... whatever you use instead of Access.

Where do I start?
posted by Mwongozi to Computers & Internet (17 answers total) 2 users marked this as a favorite
Well, for starters, you use MySQL instead of Access.

Step 1: Get an account on a linux host that supports LAMP (Linux, Apache, MySQL, PHP). (IE: Most decent web hosts nowadays.)

Step 2: Bookmark this page (PHP Documentation), and get to know this one (MySQL functions in PHP) especially well. This one (MySQL Documentation) will also solve some problems.

Step 3: Brush up on your SQL. This will help.

Step 4: Learn a bit of bash. This will help.

Step 5: Think of something you want to build, and go for it.
posted by cheaily at 5:40 PM on December 10, 2004

Also, these two books are immensely helpful:

Regular Expression Pocket Reference

MySQL Pocket Reference
posted by cheaily at 5:43 PM on December 10, 2004

and... whatever you use instead of Access
That would be MySQL. on preview, what cheaily said

Linux is the OS, Apache is the web server, MySQL is the DBMS, and PHP is the scripting language.

Do you want to learn these all together? Because if you want to make a gradual transition, you might want to start by experimenting with a WAMP installation to reduce the number of new stuff you're tackling at once.
posted by nakedcodemonkey at 5:47 PM on December 10, 2004

Response by poster: Well I have some basic experience of Linux, and I know SQL. (Well, I enough *enough* SQL.)

On Windows you (can) design your database in Access but SQL Server (or something like it) is the server. I guess there's no Access equivalent for Linux.
posted by Mwongozi at 5:57 PM on December 10, 2004

If you have a Linux box, all the parts you need to set up web-based application are available in all of the common distros. In Fedora/RedHat, you can simply select MySQL, Apache and PHP as part of the install.

Also, rather than opening an account at some remote host, why not just set up Apache on your own box, and point your web browser to "localhost"? Your "web site" will only be available to you, but for learning and for trying things out, it works great.

O'Reilly's Programming PHP is a good place to start. Once you're serving up web pages, adding a database backend is really pretty simple.
posted by SPrintF at 6:11 PM on December 10, 2004

When I was doing a lot MySQL I used PHPMyAdmin extensively. It's a web-based tool for creating, querying and administering your MySQL server and databases. You can also use Access as a front-end for MySQL through ODBC but I do not recommend that for schema creation. Due to the vagaries of ODBC you do not always get the results you want, especially in terms of datatypes.
posted by SNACKeR at 7:11 PM on December 10, 2004

You colud also do a Windows installation of PHP, Apache, and MySQL with phpdev or Foxserv. If you are more comfortable doing local development in Win that is.

What cheaily said, as well as crack open a few GNU/GPL php packages and look at the code and see what it does. Sitepoint has some good tutorials and info.

Also remember to turn register_globals off.
posted by dasibiter at 7:24 PM on December 10, 2004

XAMPP is a good way to get Apache, MySQL, php and perl all set up on your Windows box.

Or you can start with PHP on IIS with SQL Server . This way you're only learning PHP to start. Then you can go to Apache and Linux later more easily. I've done some projects with PHP on Windows with IIS and SQL Server and both were big successes.
posted by gus at 7:38 PM on December 10, 2004

I guess there's no Access equivalent for Linux.



Though, you don't really need it. just use the mysql command line tool.
posted by cheaily at 7:51 PM on December 10, 2004

You can also use Perl for the P in LAMP. (PerlMonks is a great place for beginners, as is O'Reilly's Learning Perl.)
posted by thebabelfish at 8:00 PM on December 10, 2004

webmonkey tutorials + devshed tutorials + ubuntu (a really easy to use distro that still has the meat of debian) + (a preconfigged LAMP OR use apt-get to install--both apt-get and an apt-gotten LAMP will work right out of the gate on ubuntu).

Just burn yourself an ubuntu iso, boot up with it, click a few okays to install, and pull up a command prompt.

sudo apt-get update
sudo apt-get upgrade
sudo apt-cache search apache
sudo apt-get install apache

Then start firefox (it's built right in) and read tutorials and play until you pass out. :)

The pick a project idea is a good one . . . start with something very simple but enjoyable and worth building on later like a personal cd database searchable by artist and album title. Oh, and do learn vi eventually for the ability to edit oh-so-quickly, but just start off with something simple like nano to avoid distractions/getting overwhelmed. I also agree with the suggestion to let P stand for Perl.

Oh, and I promise I'm not shilling for ubuntu.
posted by littlegreenlights at 8:33 PM on December 10, 2004

The answer depends on whether you want professional-level expertise, or whether you want to be a hobbyist. I'm not making any value judgments here because both are obviously valid choices. But the situation is genuinely different depending on your goals.

If you're more of a hobbyist, go with Linux/Apache/MySQL/PHP on a host, and use phpMyAdmin. In short, use tools that help you out by taking care of low level details. Ignore everyone who tells you that you shouldn't use the Linux distro/database tool/scripting language that makes your life easier. You don't want to learn everything -- you just want to learn enough to have fun and make neat things.

If you want to understand the low level, install Linux/Apache/MySQL/PHP on your own. Use the MySQL command line rather than phpMyAdmin. Learn to normalize schemas and do joins as easy as you breathe. Get a distro like Debian, or abandon Linux for one of the BSDs. Learn a few more languages, like Perl and Python. Start thinking about servlets, Tomcat, and Java. Ask questions (and my email's in my profile). This is much, much harder but you will understand more. If you plan on using these skills professionally, go this route. Eventually you will get to the point where you can do more -- and more quickly -- than you could if you used shortcuts and abstractions.
posted by amery at 9:15 PM on December 10, 2004

For free-software sites, we use:
freebsd/apache/php/postgresql or

Linux is a fine learning platform, we avoid it because it tends to optimize towards being easy for beginners not experts, and because it still doesn't handle utterly absurd levels of load with the same grace as BSD. Doesn't really matter though, just make sure you know how to keep your chosen distro up to date.

Apache - it's all covered online... your first non-standard config will be the hardest, but the config file syntax is easy... if you need to do hard things with apache, you'll learn how in no time. If you don't, even easier.

PHP - if you're already a competent programmer the online references should be plenty to have you up and coding quickly. Personally, I never found a PHP book that was worth owning.

Tomcat - works just like java servlets on windows, except with 90% less suck. again with the online reference being good.

PostgreSQL - some people use MySQL instead. We wrap everything in a relatively database transparent abstraction layer so we can change easily, but we default to postgres because mysql has a strong tendancy to completely suck if you start doing really complex activities in the db. for most purposes, mysql is fine. and once more, the online reference is good.

as for designing our dbs... we do it the old fashioned way... by manually creating schemas.
posted by mosch at 2:21 AM on December 11, 2004

When I was doing a lot MySQL I used PHPMyAdmin extensively. It's a web-based tool for creating, querying and administering your MySQL server and databases.

I'm not fond of phpMyAdmin. Much prefer MySQLCC, and it is a closer analogue to Access.

You can also use Access as a front-end for MySQL through ODBC but I do not recommend that for schema creation. Due to the vagaries of ODBC you do not always get the results you want, especially in terms of datatypes.

This is good advice. Access is decent as a front end for browsing/editing existing databases, but don't create using it.

Though, you don't really need it. just use the mysql command line tool.

Somewhat true, and I highly recommend learning to use the command line tool, but there are situations (usually when you've got tables with a lot of columns or "wide" columns full of data) where reading data from the terminal sucks -- having a spreadsheet-like interace can be a godsend for certain kinds of browsing/testing.
posted by weston at 5:13 AM on December 11, 2004

I like ADOdb. It lets you abstract your DB calls so that you can change db engines less painfully.
posted by tomierna at 8:05 AM on December 11, 2004

Piggyback question: say you want to learn all this stuff because it seems to be a high-paying and somewhat interesting career choice, but you don't have any projects in mind to practice/experiment on (at least in part because you don't have a clear idea of what databases can be used for). How do you learn, and how do you find projects to keep yourself motivated?

Assume little money is available, if possible.
posted by squidlarkin at 10:39 AM on December 11, 2004

I second the opinion that postgresql is best for projects of any significant size. As for finding ways to motivate yourself... in a "give him the fish" spirit, I'd suggest trying to code up a database-driven weblog in PHP; that's a pretty simple project, really. I'm curious about the opinion that this seems to be high-paying... from reading Slashdot, you'd think programmers were being being fed gruel and lashed.
posted by gsteff at 8:46 PM on December 11, 2004

« Older desktop wallpaper   |   New Yorker Calendar Newer »
This thread is closed to new comments.