Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

How to Do Everything with PHP and MySQL

timothy posted more than 9 years ago | from the everything-is-a-big-word dept.

Databases 354

Michael J. Ross writes "When it comes to creating a dynamic Web site with data store capabilities, the site developer can choose from many technologies, including PHP and MySQL. The combination of the two is rapidly emerging as a favorite, partly because they work well together, and partly because they are both available under open-source licenses. As a result, technical book publishers are cranking out a growing number of high-priced tomes that try to cover all of the details of either technology, or both. But for the developer just getting started in either one, there is a new title that could prove more accessible: Vikram Vaswani's How to Do Everything with PHP and MySQL, published by McGraw-Hill/Osborne." Read on for the rest of Ross's review.

The publisher has a page on their Web site devoted to the book; for some reason, it lists the book as containing 400 pages, but my copy has 381. The page also has links to a table of contents and a sample chapter, namely the first one. For those readers with very slow Internet access or unstable Adobe Acrobat plug-ins installed, be aware that the sample chapter -- and even the table of contents -- are offered only as PDFs, but the two links give no warning.

Most technical publishers, for every one of their books, wisely have links to the errata and sample code, right there on each book's Web page. This is the best approach, because when readers are having difficulty getting a book's examples to work correctly, they want to be able to quickly find and download the most up-to-date sample code, as well as check the errata page for any bugs in the printed code. Unfortunately, McGraw-Hill/Osborne has their links to those two types of information in an easily-overlooked part of a menubar, using small black text on a blue background. The links are near the upper left-hand corner, and outside the content section of the Web page, where the typical reader would be seeking fruitlessly for them.

The companion Web site for the book is hosted by Vaswani's software consulting firm, Melonfire. The site has the book's table of contents (in HTML), a link to chapter 1 in PDF, a profile of the author, three full-length case studies, a feedback form, and an extensive collection of links to PHP and MySQL reference material, discussion lists, articles, and tutorials. At the end of the Introduction in the book, the author invites the reader to use that companion site for connecting with other PHP users, and sharing their thoughts on PHP and MySQL development. The site itself has no such forum, so the author probably meant the discussion lists.

The companion site also has a link to download a Zip file containing all of the sample applications from the book -- from chapters 7, 12, and 16 -- comprising nine PHP scripts, an SQL file, and a data file. The code snippets themselves do not appear to be included in the download. This shouldn't pose a difficulty for the typical reader, since few of the code snippets are long. Besides, typing them in on one's computer can help to reinforce the language syntax that one is learning, as well as decent code formatting (valuable for newbies).

The book is organized into four parts.The first of these presents the basics of PHP and MySQL, including the history and features of both technologies, as well as how to install them on Unix and Windows systems, verify the integrity of the installations, and make some critical security and configuration changes, such as changing passwords. Parts II and III cover the basics of PHP and MySQL, respectively. The fourth and final part describes how to use the two together. To that end, every chapter contains snippets of code to illustrate the ideas being described. In addition, each section is wrapped up and illustrated with a sample application. For PHP, the author shows how to build a session-based shopping cart. For MySQL, he presents a simple order-tracking system. For using PHP and MySQL together, he shows a news-publishing system.

Despite its title, the book clearly does not tell the reader how to do everything with PHP and MySQL. As the author notes in the Introduction, the book is not designed to be a complete reference for either technology, but instead intended as a tutorial for Web developers who are interested in learning how to do server-side scripting in combination with a database management system. Vaswani states that he does not assume prior knowledge of programming or database fundamentals, and that these basic concepts will be taught by example, using tutorials and realistic examples. I suspect a reader not familiar with HTML, however, could be easily baffled by the book. On the other hand, most if not all developers reading a book on PHP or MySQL are likely to already know HTML well enough to understand the output of PHP-enhanced Web pages.

One strength that this book has over many similar ones is that the author explains up front how to install PHP and MySQL, rather than relegating these topics to an appendix, or skipping them entirely. This is critical, because many programmers will find that the most challenging aspects of getting started with PHP and MySQL, are simply getting them installed and working, along with a Web server, such as Apache -- and not coding the applications themselves.

Another welcome aspect of the book is the author's enthusiasm for the technologies -- although characterizing MySQL as "quite friendly" (page 150) is a stretch. Furthermore, his explanations are clear and concise. In addition, Vaswani makes no pretense that his book has all the answers; he frequently refers the reader to URLs in the online manuals of the products, for more details. In addition, he does a nice job of illustrating the advantages of normalized database tables, and later explaining how to format query output -- an important topic omitted in many similar books.

Yet, like all books, this one is not perfect. There are a number of errors or pitfalls in the book that could confuse the reader. They range from incomplete explanations of what a user will see when running particular commands, to the sort of errata one finds in all technical books. I found over two dozen in total (there may be more). In the interests of keeping this Slashdot version of the book review close to the recommended length, I won't list all of the problems here, but will instead refer the reader to a longer version of this book review, if they are interested in those details.

Aside from its many minor flaws, I recommend this title to any programmer who wants to learn the basics of PHP and MySQL. Even though the publisher could improve their production quality, choice of binding, and Web page, the author has done a good job of clearly presenting the major points. Future editions could incorporate fixes to the errors noted in the longer version of this review, as well as better explain to the neophyte how to test/debug the code snippets. Nonetheless, the intended reader would be well served by this particular book.


Michael J. Ross is a freelance writer, computer consultant, and the editor of PristinePlanet.com's free newsletter. You can purchase How to Do Everything with PHP and MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×

354 comments

Sorry! There are no comments related to the filter you selected.

It can do everything! (5, Funny)

Anonymous Coward | more than 9 years ago | (#12953563)

This is finally the book that I need to write my php/mysql based operating system. Linux and Microsoft are dead!

Re:It can do everything! (3, Funny)

macaulay805 (823467) | more than 9 years ago | (#12953700)

Google? Is that you?!

Re:It can do everything! (1)

Leroy_Brown242 (683141) | more than 9 years ago | (#12953858)

The next new thing!

An OS, emulated on APACHE!

Instructions: (5, Funny)

Anonymous Coward | more than 9 years ago | (#12953567)

Step 1: Use Emacs as your text editor.

Re:Instructions: (1)

asdcore (779572) | more than 9 years ago | (#12953708)

Hey, you didn't finish...
Step 1: Use Emacs as your text editor. When you realize you already have an operating system, use *vi* as your text editor.

Re:Instructions: (0)

Anonymous Coward | more than 9 years ago | (#12953843)

Bah! text editors like vi and emacs are for the weak.

I code php direclty from the shell:

echo '<html><body><? cool php script ?></body></html>' > coolpage.php

To hell with productivity. If I wanted that I'd quit surfing slashot at work(which i'm doing via telnet to port 80, BTW)

Re:Instructions: (1)

creimer (824291) | more than 9 years ago | (#12953761)

Personally, I like Crimson Editor [crimsoneditor.com] for Windows better. :)

Re:Instructions: (4, Funny)

CTalkobt (81900) | more than 9 years ago | (#12953805)

Step 2: Enable VI Compatibility mode within EMACS.

Step 2) Quit Emacs, then start vi... (1)

sir lox elroy (735636) | more than 9 years ago | (#12953863)

/me ducks the tomatoes. :-)

QUIT emacs?!? (2, Funny)

PlacidPundit (881182) | more than 9 years ago | (#12953974)

I would very much like to. But my fingers won't spread far enough to hit all the keys.

Re:Instructions: (1)

Leroy_Brown242 (683141) | more than 9 years ago | (#12953888)

VIM!

Re:Instructions: (1)

AvantLegion (595806) | more than 9 years ago | (#12953983)

Step 1: Use Emacs as your text editor.

This has to be one of those, "Step 2: ?????", "Step 3: Profit!" things...

Comparison to Other Books? (4, Informative)

Uber Banker (655221) | more than 9 years ago | (#12953572)

How different is what this book covers from what this [slashdot.org] , this [slashdot.org] , this [slashdot.org] , or this [slashdot.org] ?

Re:Comparison to Other Books? (-1, Troll)

Anonymous Coward | more than 9 years ago | (#12953728)

Nothing. Remember who owns /. and has a say in what is posted on here. The reality is that this "review" is disguised as an adveritsment, just like the others. Kudos to our /. editors. Real nerds learn from free documentation on the web (and php.net has, by far, one of the best language manuals/refernces).

1P: Yellowlight (-1, Offtopic)

Anonymous Coward | more than 9 years ago | (#12953575)

fristprostFTWyo

But what does TripMasterMonkey have to say?

I'M DYING TO KNOW!

Re:1P: Yellowlight (0)

Anonymous Coward | more than 9 years ago | (#12953693)

Duhhh!
You've jinxed it now, he won't post in this article.

Like the old saying goes (5, Funny)

grazzy (56382) | more than 9 years ago | (#12953577)

Dont buy a book about PHP AND MySQL.

Seriously, buy one for each one of them.
Then, when you've bought those two, you can stack them under your laptop and type in:

http://www.php.net/ [php.net]
http://mysql.com/doc/ [mysql.com]

Ready to go!

Re:Like the old saying goes (2, Informative)

Nos. (179609) | more than 9 years ago | (#12953665)

I would have moded insightful instead of funny. I'm a fan of php, and one of the reasons I like it so much, is their website. Its a very complete reference to the language, and the user comments included with each function are inavluable. In fact, one of the best things about the website is its ease of use. If I'm trying to remember exactly how a function works, its as easy as http://ca.php.net/function [php.net]

Re:Like the old saying goes (1)

DigitumDei (578031) | more than 9 years ago | (#12953904)

Hell the php .chm is wonderful [php.net] as well.

When I started developing in php and mysql I went out and bought "Open Source Web Development with LAMP". It was recommended, and apparently was very helpful. After an hour, put it on the bookshelf and went to php.net, and haven't looked back since. Anything that is in these books I can usually figure out myself with the help files, and anything I cannot figure out myself usually isn't in the book (though there is always a web site somewhere with example code that does exactly what I want).

buy a MySQL book (1)

John Seminal (698722) | more than 9 years ago | (#12953705)

and get the php book from the library.

why?

php won't require lots of reference, once you learn something, you won't need to look it up. but with mysql, you will want a reference.

the other reason, once someone learns php, they will probably want to move on to another language. save the $50 from the php book and use it for a Java book.

that is if people are like me and have limited money. get the most bang for the buck. there is no reason to have a book that you use once and then don't need. it is better to buy books you will keep using.

i learned MySQL while writing a forum based application using JSP. MySQL is very fast, very user friendly, and it never failed me. But it does require a good reference book, otherwise you will go mad. and if you will be using MySQL on a network, make sure to password protect it, please. ;)

No, buy a SQL book (4, Insightful)

DogDude (805747) | more than 9 years ago | (#12953791)

I can't stress strongly enough that people NOT buy a MySQL book. Buy a SQL book. Even better, buy a RDBMS book. We have enough people doing stupid things with data. We don't need any more. You might as well suggest that somebody buy a Windows 95 book.

Re:Like the old saying goes (1, Insightful)

Anonymous Coward | more than 9 years ago | (#12953756)

Fully agreed,

those two sites are more informative than any book I've read on PHP/MySQL. Even with moving from php3 to php4 and then php4 to php5 or from mysql 3.x to 4.x I have still yet to purchase any documentation for either of the two.

Any book I've picked up at the local book store on the subject I've found to have too much filler and have somehow stretched out 1 paragraph in to two pages.

If anyone is going to be getting into PHP/MySQL do your self a favor and just read through the tutorials and syntax examples on the parents post. I guarentee they will be just as, if not more informative as any $25 - $50 book you'll purchase at a book store and you will have the option of Ctrl+F.

Re:Like the old saying goes (1)

Parham (892904) | more than 9 years ago | (#12953890)

I'd have to agree, my perfect PHP book would be one where they just dumped all the PHP documentation into it... and magically let me search it like I can on the website with user comments: PHP Manual [php.net]

Re:Like the old saying goes (1)

Albanach (527650) | more than 9 years ago | (#12953918)

Would you really do that to your eyes?

It's true, PHP and MySQL both ahev great doccumentation. It's very complete, the examples are well laid out and commented but to learn a language from the on screen doccumentation?

I like to be able to lie with a book in bed, in the garden, on the bus, all the places I don't really want to be with a laptop.

When you're physically coding at the keyboard the online doccumentation is often the fastest way to look up a query, but you can really get a feel for something by spending time reading and understanding a book away from the keyboard. I guess that's why there's so much money to be made in writing computer books.

bah! (0)

Anonymous Coward | more than 9 years ago | (#12953580)

much rather use aolserver and postgres.

I prefer a different book (3, Funny)

RelliK (4466) | more than 9 years ago | (#12953590)

It's called "Why Not To Do Everything with PHP and MySQL". ;-)

Re:I prefer a different book (1, Funny)

Anonymous Coward | more than 9 years ago | (#12953860)

Yes, but that one is more advanced. This one said it was for beginners.

haha (3, Funny)

macaulay805 (823467) | more than 9 years ago | (#12953591)

The quote at the bottom of the Slashdot page says it all:

He flung himself on his horse and rode madly off in all directions.

*sigh* (0)

Anonymous Coward | more than 9 years ago | (#12953597)

Vaswani states that he does not assume prior knowledge of programming or database fundamentals, and that these basic concepts will be taught by example, using tutorials and realistic examples.

We wouldn't anybody actually learning fundamentals, would we?

On the plus side, when these newbie programmers hit the brick walls that surround PHP and MySQL, they will pay big consulting dollars to rewrite their sites with something else.

I was reading a mailing list the other day (think it was the Rails list) where programmers were actually *bragging* that they didn't use database contraints or views. Uhm, yeah. I can write programs without using subroutines but I wouldn't brag about it.

woopee (0)

Anonymous Coward | more than 9 years ago | (#12953602)

yet another waste of paper and time with the Xth book on these two particular pieces of software. what's so special about this one that sets it apart from all the other books?

bah! (-1, Troll)

Anonymous Coward | more than 9 years ago | (#12953607)

PHP is a toy language for kids.

Re:bah! (1, Insightful)

Anonymous Coward | more than 9 years ago | (#12953662)

excatly. and mysql is a toy as well. when they're done playing, they can move to postgres.

Re:bah! (4, Insightful)

downward dog (634625) | more than 9 years ago | (#12953718)

PHP is a full programming language. You can do basically anything in PHP that you can do in Perl, Java, .NET, Ruby, etc.

Granted, PHP lends itself to sloppier code than some other languages. Or rather, it _allows_ you to write sloppy code. But this is only a disadvantage if the developer is unskilled/undisciplined. A skilled PHP programmer can write robust, object-oriented code that follows the same design patterns as Java. It's just that certain Java frameworks force every project to be heavyweight, while PHP allows you to do a lot of things simply. If you want to write yourself a simple photo gallery app, why bother with Struts?

I write this as an ex- (not current) PHP programmer. I recently made the switch to Ruby on Rails, which has proved to be fantastic thus far.

Never trust anyone who says "Language X is terrible and Language Y is great."

Re:bah! (1)

google (125927) | more than 9 years ago | (#12953855)

But... but... but... I want a language that does everything! Thus I will finally prove Godel wrong once and for all!

Besides Slashdotters Gross Conceptual Errors in programming language theory, I already have my desk references, and they are written by insane, whimsical men known as Knuth and Corman. Sometimes they require use of a secret decoder ring found in select Cracker Jack boxes to figure out, but are entirely more useful than something that could be grokked online.

Re:bah! (1)

cosinezero (833532) | more than 9 years ago | (#12953911)

You can do basically anything in PHP that you can do in Perl, Java, .NET, Ruby, etc.

-->Um, wrong. So very, very wrong.

Re:bah! (1)

downward dog (634625) | more than 9 years ago | (#12953963)

So... Let's see some examples.

Re:bah! (2, Insightful)

Decaff (42676) | more than 9 years ago | (#12953957)

A skilled PHP programmer can write robust, object-oriented code that follows the same design patterns as Java.

This isn't quite true. A good example is that many very-high load Java websites use application-scoped caching of data. This is very hard to do elegantly in PHP.

Java was designed to be object-oriented from the start. With PHP, it was an afterthought.

It's just that certain Java frameworks force every project to be heavyweight, while PHP allows you to do a lot of things simply. If you want to write yourself a simple photo gallery app, why bother with Struts?

Java also allows you to do a lot of things simply. There is nothing forcing you to use those Java frameworks. You can write everything in scripted JSP pages.

Re:bah! (1)

SomeOtherGuy (179082) | more than 9 years ago | (#12953959)

Great reply.

And this captures it in a nutshell. Ease of use (even sloppy use), documented examples, price, and saturation is 9/10's of the battle...And PHP has claimed all of those crowns.

MySQL good, PHP not so good (-1, Troll)

John Seminal (698722) | more than 9 years ago | (#12953621)

My advice to everyone who wants dynamic websites is to use MySQL for the database, it is very good. But don't use PHP, use JSP and Tomcat.

There are many reasons why I would give this advice:

  • PHP websites are more vulnerable to worms. Just six months ago, many PHP run forums were shut down and destroyed. The exploit was something that worked only with PHP forums.
  • Java is the better language to learn. It is more like a true programming language than PHP. The reward for the time spent learning a language is greater with Java than with PHP.

I always thought of PHP as more of a scripting langugae, and not a true language. No large PHP applications exists out there. But there are tons of enterprise Java applications.

Re:MySQL good, PHP not so good (0)

Anonymous Coward | more than 9 years ago | (#12953710)

Ha! JSP is just as prone to worm attack due to bad coding. Java is also a interpreted language just like PHP so java is also a "scripting" language. (Not that theres anything wrong with that)

Re:MySQL good, PHP not so good (0)

Anonymous Coward | more than 9 years ago | (#12953737)

What are you smoking? Java ain't interpreted.

Re:MySQL good, PHP not so good (1)

chris_mahan (256577) | more than 9 years ago | (#12953713)

Not so fast.

Java is proprietary.

PHP not a true language? (1)

ChipMonk (711367) | more than 9 years ago | (#12953732)

The last I knew, PHP had variables, conditionals, loops, and functions. Perl has these, too, as do Python, Lisp, Bash, and even PostScript. Their Turing completeness has nothing to do with their execution environments.

Re:MySQL good, PHP not so good (2, Informative)

moonty (704069) | more than 9 years ago | (#12953747)

The problem with these PHP run forums was not that they were written in PHP, but with the forums themselves. Blaming the language for the problems is like blaming the English language for mangling George W. Bush's speech, while the fact is that the English language is merely what he is speaking. Granted, there were security issues with PHP that didn't help much, but it isn't entirely the fault of the language.

Also, you must not have explored PHP much if you don't think any large applications exist.

Re:MySQL good, PHP not so good (1)

downward dog (634625) | more than 9 years ago | (#12953766)

Java is only the better language to learn if you work on large projects with a team of programmers. For 1-3 programmers on a mid-sized project, I'd take PHP over Java any day.

And what's this business about scripting languages not being true languages?

Re:MySQL good, PHP not so good (0, Flamebait)

jsight (8987) | more than 9 years ago | (#12953773)

Or better yet, use Wicket on Java [sourceforge.net] and PostgreSQL [postgresql.org] .

It was the language and not the code? (3, Insightful)

Wee (17189) | more than 9 years ago | (#12953807)

At the risk of feeding the trolls...

PHP websites are more vulnerable to worms. Just six months ago, many PHP run forums were shut down and destroyed. The exploit was something that worked only with PHP forums.

So it was a shortcoming endemic to the langauge, and not sloppy coding, right? I mean to say, PHP itself was at fault, due its very nature? A similar thing can't possibly happen in a "real" programming language like Java?

Java is the better language to learn. It is more like a true programming language than PHP. The reward for the time spent learning a language is greater with Java than with PHP.

That's begging the question [skepdic.com] . And wooly-headed thinking at its best. I'd argue that the barrier to entry is a lot lower with PHP than Java (or C, C++, .Net, et al.). So someone new to the language is bound to see results faster. But your point is nonsensical to begin with...

I always thought of PHP as more of a scripting langugae, and not a true language. No large PHP applications exists out there. But there are tons of enterprise Java applications.

A scripting language is a "true language". BASIC is a true programming langauge. MSDOS batch is a true programming langauge. Further, have you ever heard the saying "use the right tool for the job"? There are a lot of types of websites filling a lot of roles. Many (most?) of them don't need the overhead and complexity of an enterprise-class system. Use what works, without specious limitations brought on by technical snobbery.

-B

Re:MySQL good, PHP not so good (1)

Peter Cooper (660482) | more than 9 years ago | (#12953812)

PHP websites are more vulnerable to worms. Just six months ago, many PHP run forums were shut down and destroyed. The exploit was something that worked only with PHP forums.

I don't think PHP sites are inherently more vulnerable because they use PHP. I think it's because PHP coders are more likely to be amateurs, and PHP projects more likely to be developed by new coders, that they'd have holes. It's not a failure of PHP IMHO. It just happens that more bad coders use PHP.

Re:MySQL good, PHP not so good (3, Insightful)

hobbesx (259250) | more than 9 years ago | (#12953814)

PHP websites are more vulnerable to worms


If this is the worm I am thinking about, it was specific to one particular forum, which is quite popular and written in PHP. The exploit was a vulnerability in the source, not PHP itself. Is all JSP code automatically uber-secure?


And if the 'reward' of programming with a 'real' programming language is that much better, write your web-apps in C, or ::shudders:: Assembly... For now, I'll use the tool that is best suited for the job based on it's merits and my ability to complement them. (Unless the reward is cash, in which case, I complement cash whoreing quite well...)

Re:MySQL good, PHP not so good (1)

ScytheBlade1 (772156) | more than 9 years ago | (#12953864)

How about you learn the language before you speak out of what google news and fellow slashdotters tell you?

Saying that there was a worm that only affected PHP forums is only a half-truth, at best. It only affected a single PHP based forum, not every PHP forum made in existance. The flaw there was a hole in the software, NOT a hole in PHP. Have there been holes in PHP? Of course, there's hole in everything else, too. The exploit was not in PHP, it was in some software that's coded in PHP. Using your thinking, that's like saying C is a horrible language because if you don't know what you're doing, there's a chance of a buffer overflow.

From "A Note on Security in PHP" [php.net] :
" A recent Web Worm known as NeverEverSanity exposed a mistake in the input validation in the popular phpBB message board application. Their highlighting code didn't account for double-urlencoded input correctly. Without proper input validation of untrusted user data combined with any of the PHP calls that can execute code or write to the filesystem you create a potential security problem. Despite some confusion regarding the timing of some unrelated PHP security fixes and the NeverEverSanity worm, the worm didn't actually have anything to do with a security problem in PHP."

The phpbb developers are not stupid, they are competent people. Yet, there was a hole. It happens, no one is perfect.

I'm quite certain that JSP/Tomcat can be just as insecure if you code it wrong. Same with ASP. Or, gasp, anything.

Re:MySQL good, PHP not so good (0)

Anonymous Coward | more than 9 years ago | (#12953883)

Java and JSP and javascript are all steaming piles of dog shit. They are slow, the interpreters are buggy, and I've never had ONE fucking java app run like it was supposed to.

FUCK I HATE JAVA, WRITE IN C++.

Re:MySQL good, PHP not so good (1)

Just Some Guy (3352) | more than 9 years ago | (#12953919)

use MySQL [...] JSP and Tomcat.

The performance of Java and the functionality of MySQL. There's a match made in hell for ya.

Seriously, do their problem domains overlap at all? Big servers with plenty of resources: Java + an ACID database. Small servers that want to be responsive at the expense of all else (like complex functionality and data integrity): PHP + MySQL. I can't imagine harnessing DB2 to PHP, and the inverse doesn't seem a whole lot more sane.

I know someone's going to pipe up and announce that they've been using PHP and an Oracle to drive their website for years, but it still just feels wrong.

Language Bigot Alert! (-1, Offtopic)

Anonymous Coward | more than 9 years ago | (#12953940)

My advice to everyone who wants dynamic websites is to use PostgreSQL for the database, it supports more of the SQL standard. But don't use JSP, use Ruby [ruby-lang.org] and Rails [rubyonrails.com] .

There are many reasons why I would give this advice:

  • Java is not Free as in Freedom. This might not matter to some, but it does matter to me.
  • Web applications in Java require complex application servers like Tomcat or JBoss to run.
  • There are half a billion different web, database, and other "frameworks" out there for Java, and they nearly all incompatible with each other. You'll spend a week figuring out how to publish a SOAP call using JAX-RPC, for example. Spring, Hibernate, EJB, Tapestry, Torque, Struts... so many crappy ways to do the same thing!
  • Java forces you to love duplicating things you've expressed in code in myriad XML configuration files.
  • Jerks like this [jroller.com] .

I always think of Java as more of a distraction for CS students and developers who like to secure their jobs behind layers of complexity and expensive purchases of commercial software ("we paid thousands for this, now we have to use it!"). This probably accounts for the success of Java in the corporate world.

Huge, enterprise applications can be written in any language; hell, Yahoo! runs on PHP for god's sake, as does Lufthansa's ticketing system [zend.com] . Languages are languages. What makes a "real" one in your eyes? The only thing you should be concerned about is code quality. Whether a language is interpreted or byte-compiled really means nothing.

One size doesn't fit everything (4, Informative)

vlad_petric (94134) | more than 9 years ago | (#12953623)

PHP has two major shortcomings as far as high performance is concerned:

1. No proper database connection pooling (and no, pconnect is not connection pooling).

2. Can't really run Apache2 in its threaded mode because a lot of php libraries are not thread safe (although php itself is).

Don't get me wrong, I *love* both php and mysql, but for highly-trafficked sites, jsp is definitely a better choice (from my own experience).

Versions (2, Interesting)

amembleton (411990) | more than 9 years ago | (#12953645)

Which Version of PHP does this book apply to?
Which Version of mySQL does this book apply to?

Specifically, does it cover PHP5?

Re:Versions (2, Informative)

puppetman (131489) | more than 9 years ago | (#12953803)

Good point - and MySQL 4.0, 4.1 (sub-selects) or 5.0 (in beta - stored procedures, triggers)

both available under open-source licenses? (-1)

Zeut (24694) | more than 9 years ago | (#12953656)

Last I checked MySQL was only available for free if you used it for non-commercial purposes. Whereas PostgreSQL is free for everyone. I really don't understand why people keep pushing MySQL. The argument that it's faster is only true for the simplest of database applications.

Re:both available under open-source licenses? (2, Insightful)

markybob (802458) | more than 9 years ago | (#12953776)

you're absolutely wrong. mysql is dual-licensed, with one of those two being the GPL. the GPL is not only for non-commercial. seriously, read up before throwing stones.

Re:both available under open-source licenses? (1)

l-ascorbic (200822) | more than 9 years ago | (#12953786)

Sorry, but you really have not got a clue. MySQL is GPL [mysql.com] .

Re:both available under open-source licenses? (1)

svallarian (43156) | more than 9 years ago | (#12953877)

It's only free if you release your web app as GPL also.

Re:both available under open-source licenses? (0)

Anonymous Coward | more than 9 years ago | (#12953921)

"Free use for those who never copy, modify or distribute. As long as you never distribute the MySQL Software in any way, you are free to use it for powering your application, irrespective of whether your application is under GPL license or not."

Re:both available under open-source licenses? (1)

markybob (802458) | more than 9 years ago | (#12953973)

again, WRONG. you need a license to DISTRIBUTE mysql with your non-gpl'd app.

Re:both available under open-source licenses? (1)

markybob (802458) | more than 9 years ago | (#12953833)

can someone please mod this idiot down? htf does he have a "score 3 informative" when he doesnt even know that mysql is available under the GPL?

Re:both available under open-source licenses? (1)

Zeut (24694) | more than 9 years ago | (#12953953)

I'm well aware that it is dual licensed, however it's not like you can just choose whichever license you want. From their license found on:

http://www.mysql.com/company/legal/licensing/comme rcial-license.html [mysql.com]

The Commercial License is an agreement with MySQL AB for organizations that do not want to release their application source code. Commercially licensed customers get a commercially supported product with assurances from MySQL. Commercially licensed users are also free from the requirement of making their own application open source.

When your application is not licensed under either the GPL-compatible Free Software License as defined by the Free Software Foundation or approved by OSI, and you intend to or you may distribute MySQL software, you must first obtain a commercial license to the MySQL product.

Re:both available under open-source licenses? (2, Informative)

Al Dimond (792444) | more than 9 years ago | (#12953848)

MySQL is dual-licensed; it is available for free download, and if you wish you may distribute it under the terms of the GPL. A commercial license can also be bought, and I think that includes things like support and possibly the ability to distribute under different terms. I don't remember exactly...

Re:both available under open-source licenses? (4, Insightful)

svallarian (43156) | more than 9 years ago | (#12953900)

It's only free if you release your web app as GPL also.

Not very free IMHO.

Re:both available under open-source licenses? (1)

markybob (802458) | more than 9 years ago | (#12953934)

gimme a break. that's the difference between GPL and LGPL. that's like saying bsd is MORE free than GPL.

Not entirely correct (2, Informative)

Safety Cap (253500) | more than 9 years ago | (#12953937)

You cannot distribute MySQL without a license, but you can use it to your little "I 'program' databases... but what's this primary key thingie I keep hearing about" self.

That being said, it is a toy database, and as such, should not be used on serious projects (i.e., anything that uses normalized data schemas and requires data integrity).

How to Do Everything with PHP and MySQL (0)

Anonymous Coward | more than 9 years ago | (#12953669)

So, in effect this can mow the lawn, feed the kids and keep the feds off my tail while i work on my plans for world domination?

Most comments to this review (4, Insightful)

jbellis (142590) | more than 9 years ago | (#12953673)

will be either "wooo! php rocks!" or "php sucks, use a Real Man's language like java."

Which is sad, because as much as PHP sucks [blogspot.com] , J2EE solutions suck just as badly in different ways. (That's another article.)

You forgot... (1)

DogDude (805747) | more than 9 years ago | (#12953741)

...MySQL! There are a few of us who hang around /. who know databases (a very few), and we've always got to chime in whenever MySQL is mentioned.

Oh yeah...

MySQL sucks. Not a real RDBMS. Very limited. Not ACID compliant. blah, blah, blah.

Re:You forgot... (2, Informative)

a1cypher (619776) | more than 9 years ago | (#12953828)

The book I was just reading on mySQL said that the InnoDB table's were ACID compliant...

Re:You forgot... (0)

Anonymous Coward | more than 9 years ago | (#12953929)

Yes but older versions of mySQL were not so great, so obviously we must give up on it completely and NEVER EVER EVEN THINK OF GIVING IT A CHANCE!

Re:Most comments to this review (2, Funny)

zulux (112259) | more than 9 years ago | (#12953781)


will be either "wooo! php rocks!" or "php sucks, use a Real Man's language like java."

Or "Ruby on Rails is 202% Better!!!111!"

I don't know how to use RoR but all the trendy powerbooks people are using it so it's got to be cool.

Re:Most comments to this review (1)

Decaff (42676) | more than 9 years ago | (#12953899)

Which is sad, because as much as PHP sucks, J2EE solutions suck just as badly in different ways. (That's another article.)

This is wildly unfair to both technologies.

PHP can suck in some ways. J2EE can suck in others.

However, what critics of J2EE often forget is that J2EE can be used in a very light manner. Major applications have been written using only JSP pages, possibly using a rich set of tag libraries. This allows development of scripted pages in a very similar manner to PHP, but with the ability to use the very rich Java libraries if required.

Everything? (1, Funny)

Infinityis (807294) | more than 9 years ago | (#12953697)

I've been waiting for a book like this. I was really hoping to write a kernel entirely with this stuff...

Simple question (0)

Anonymous Coward | more than 9 years ago | (#12953704)

I have looked far and wide, but perhaps I need to look closer. I have not figured out why some example scripts have the '@' before sql commands and some don't. Sometimes the use is different within the same example script. The commands appear to have the same function regardless of the presence of the '@' - I can't figure it out.

Simple Answer (1)

Moth7 (699815) | more than 9 years ago | (#12953798)

"@" suppresses error messages.

Re:Simple Answer (0)

Anonymous Coward | more than 9 years ago | (#12953886)

Thank you.

Just now emerging, in 2005? (3, Funny)

skoda (211470) | more than 9 years ago | (#12953717)

The combination of the two is rapidly emerging as a favorite, partly because they work well together

Didn't PHP / MySQL emerge as a favorite about 5 years ago? Isn't the pair now a fully emerged favorite? Did I dream the year 2000 or has the author been Rip Van Winkling?

Re:Just now emerging, in 2005? (1)

ari_j (90255) | more than 9 years ago | (#12953811)

has the author been Rip Van Winkling?

Maybe he's been too busy verbing proper nouns to notice.

PHP and MySQL (2, Funny)

Anonymous Coward | more than 9 years ago | (#12953719)

The Visual Basic and Access of the next generation...

Make it stop (4, Insightful)

glwtta (532858) | more than 9 years ago | (#12953745)

I wonder if there really isn't a single person out there who knows MySQL and PHP and who can write a decent book?

Seems like the only explanation for this myriad of redundant books on such a simple topic. Really, how can there be a market that can accomodate another one of these identical books every month?

change of minds ? (1)

kreativemind (872620) | more than 9 years ago | (#12953746)

I, for one, am dedicated to PHP & MySQL but lately I"ve been experimenting with Coldfusion. Now I realize that Coldfusion is no open-source but in the past months, it has been a very good friend to me unlike PHP. CFM gave me the quick and easy commands [easycfm.com] to perform what I do on a daily basis or easy intergration ongoing projects.

In all, PHP & MySQL [devshed.com] are by far the best there is, but i still have to explore other regions. Hence, I do not look forward anytime nor in the future to ASP.Net. I like to stay away from the proprietary enforcements and give my small snippets a chance when I need them on open-source applications!

Really?! (1, Informative)

Silicon Knight (15308) | more than 9 years ago | (#12953760)

Despite its title, the book clearly does not tell the reader how to do everything with PHP and MySQL.

Darn marketing double-speak, gets you every time!

One strength that this book has over many similar ones is that the author explains up front how to install PHP and MySQL ... This is critical, because many programmers will find that the most challenging aspects of getting started with PHP and MySQL, are simply getting them installed and working

/sigh/ Practically every beginner PHP/MySQL book I've looked at describes installation in some depth. Quite often too much depth for my taste.

Re:Really?! (1)

Decaff (42676) | more than 9 years ago | (#12953979)

[Despite its title, the book clearly does not tell the reader how to do everything with PHP and MySQL.]

Darn marketing double-speak, gets you every time!

It is awesome how many /. articles become more accurate if you insert a 'NOT' in the title...

I hate the title (3, Insightful)

diegocgteleline.es (653730) | more than 9 years ago | (#12953763)

"How to Do Everything? with PHP and MySQL"?

I hate how people abuses of PHP. PHP is nice when you really need what things like PHP/ASP/etc provide, but these days some people use it for everything. I hate it. Take a look at blogs - they're not really "dynamic content", they're just static content which changes very frequently, still everybody uses PHP to implement them.

Re:I hate the title (1)

youknowmewell (754551) | more than 9 years ago | (#12953931)

I think perhaps our definitions of 'dynamic' are different.

how to do anything (-1, Offtopic)

Anonymous Coward | more than 9 years ago | (#12953777)

how to faggot yourself up the ass like Robert "Commander Malda" Taco

Insert your dick into my asshole
Remove your dick from my asshole
Insert your dick into my asshole
Remove your dick from my asshole
Insert your dick into my asshole
Remove your dick from my asshole
Insert your dick into my asshole
Remove your dick from my asshole
Insert your dick into my asshole
Remove your dick from my asshole

AND NOW, PRESENTING THE HONORABLE GENTLEMEN FROM TEXAS, CONGRESSMAN AND HOUSE MAJORITY LEADER TOM DELAY!!!!

Just Another Book... (1)

creimer (824291) | more than 9 years ago | (#12953818)

But can you build a /. from PHP and mySQL? A lot of books will show you the bits and pieces that make up a comprehensive website but usually don't show you how to put the whole thing together.

Waiting for PHP on a GPU (0, Offtopic)

G4from128k (686170) | more than 9 years ago | (#12953824)

I'm waiting until I can run PHP and MySQL on a GPU. With advances in sorting [slashdot.org] , shader programming [slashdot.org] , audio processing [slashdot.org] , and general purpose computing [slashdot.org] on GPUs, its only a matter of time before someone decides to try to do build an http server, PHP, etc. on a graphics card. One might even argue that a GPU and its RAM would make a nice secure sandbox walled off from the CPU, HD, and main OS.

Why do this? Like all good hacks, its done because its almost (im)possible and certainly not intended.

Tomes for Toms (1)

bohemian_observer (886213) | more than 9 years ago | (#12953832)

People that copy&paste from books like this and "asseble" pieces of code without proper foreknowledge of what are they doing pretty often end with bad/overblown databases and slow websites not to mention "debugging" riped code.

Melonfire (3, Funny)

MikeMacK (788889) | more than 9 years ago | (#12953847)

The companion Web site for the book is hosted by Vaswani's software consulting firm, Melonfire.

Do I really want to read a book by someone who works for a consulting firm named after the ignition of fruit?

"Rapidly Emerging"??? (0)

Anonymous Coward | more than 9 years ago | (#12953872)

I don't know where the author gets his/her infomation but I do not see any indication or evidence that it has not already "rapidly emerged."

To PHP or not to PHP, that is the question (-1, Offtopic)

DanielMarkham (765899) | more than 9 years ago | (#12953907)

I've just started up a new blog (Captain Picard is following me around! [whattofix.com] ) and it's a hosted site with MySQL and PHP
I'm an old windows programmer, Oracle, SQL Server, Access, VB, C#, etc. I keep wondering: should I take the time to learn PHP for the new site? As an enterprise architect, I used to recommend the "big" solutions to most problems my clients brought me, but I can't help but wonder if in a lot of cases simpler isn't better. I've always understood the simplicity concept with code construction but to some degree it is true of the technology itself.
There has to be a crossover point: where scripting and non-pooled database connections stop being useful, but all I hear are absolute arguments on both sides (stay open source! Stick with the big boys, kid!)
It'd be nice to see an unbiased view of the spectrum from somebody. Anybody know where there's one out there?

If everything you have is a hammer... (1)

hubertf (124995) | more than 9 years ago | (#12953922)

... then every problem tends to look like a nail.

- Hubert

Brilliant! (2, Insightful)

Soong (7225) | more than 9 years ago | (#12953945)

By posting a comment on this article, I can troll two products at once! I'm a PostegreSQL snob and a Java snob!

Of course, this book is just indicative of one of the key features of the Open Source movement: the ability to take two bad software packages and combine them to form something truely horrific.

(I wasn't using that Karma anyway.)

Perl and PostgreSQL (4, Funny)

stlhawkeye (868951) | more than 9 years ago | (#12953966)

I must be some kind of retard, I build my stuff with Perl and PostgreSQL.

PHP editorfor Linux, anyone? (2, Informative)

bogaboga (793279) | more than 9 years ago | (#12953971)

Disclaimer: This *might* be moded off-topic but I'll still ask:

If anyone can point me to a good *free* PHP editor for Linux, I'd be very glad. The editors for Linux I find here http://www.php-editors.com/review/ [php-editors.com] , are not good enough. I want one I can get for free.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?