Slashdot Mirror


How to Do Everything with PHP and MySQL

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. How to Do Everything with PHP and MySQL author Vikram Vaswani pages 381 publisher McGraw-Hill/Osborne rating 7 reviewer Michael J. Ross ISBN 0072257954 summary A tutorial on PHP and MySQL, geared to the new developer.

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.

75 of 354 comments (clear)

  1. It can do everything! by Anonymous Coward · · Score: 5, Funny

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

    1. Re:It can do everything! by macaulay805 · · Score: 3, Funny

      Google? Is that you?!

    2. Re:It can do everything! by adolfojp · · Score: 2, Funny

      http://www.masswerk.at/jsuix/> Been there, done that. :-P

  2. Instructions: by Anonymous Coward · · Score: 5, Funny

    Step 1: Use Emacs as your text editor.

    1. Re:Instructions: by CTalkobt · · Score: 4, Funny

      Step 2: Enable VI Compatibility mode within EMACS.

      --
      There's a gorilla from Manilla whose a fella that stinks of vanilla and has salmonella.
    2. Re:Instructions: by Decker-Mage · · Score: 2, Interesting

      Frankly I have about every editor known to man (or woman) here and Crimson has become my favorite editor for day to day use. I still like emacs (boo hiss from the Vi(M) crowd I imagine, not!), but it does the job, is light-weight, and has a price that can't be argued with.

      --
      "[I]t is a wise man who admits the limits of his knowledge or skill, and that pretending either causes harm." --Terry Go
  3. Comparison to Other Books? by Uber+Banker · · Score: 4, Informative

    How different is what this book covers from what this, this, this, or this?

    1. Re:Comparison to Other Books? by AuMatar · · Score: 2, Insightful

      Its a good reference, but its not easy to learn from. Few to no examples, and its organized as a reference, not as a tutorial. Awesome when you want to look up the parameters of some function call, hideous when you're trying to learn the capabilities of the language.

      --
      I still have more fans than freaks. WTF is wrong with you people?
  4. Like the old saying goes by grazzy · · Score: 5, Funny

    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/
    http://mysql.com/doc/

    Ready to go!

    1. Re:Like the old saying goes by Nos. · · Score: 2, Informative

      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

    2. Re:Like the old saying goes by Martin+Blank · · Score: 2, Informative

      I have it shortened even more using a Firefox keyword. The URL is http://www.php.net/%25s and the keyword assigned is php. When I need something, I just enter:

      php strings

      and it takes me right there, and with seven fewer keystrokes than you, making me more efficient. :)

      --
      You can never go home again... but I guess you can shop there.
    3. Re:Like the old saying goes by eddy+the+lip · · Score: 4, Interesting

      I'm big on books for learning and reference. I like to read, and I like to read on paper. I almost always prefer to grab something from my bookshelf and flip through the index than dig through a website. And I really want to emphasize that the PHP site is not, not, not a good way to learn the language. It's great when you want to find out why something doesn't work as documented (it's probably in the reader comments), but it is entirely useless as a way to learn how to effectively use the language.

      And that's ok - that's not it's intent. All of this "you don't need a book, just go to php.net!" is really doing a disservice to those new to the language, or those that would like to actually learn good programming technique. Regarding the latter, the reader comments are generally abysmal and show the ignorance common in a (relatively) young community. For those just starting out, random access to > 3000 functions is not useful. At all.

      With that little rant out of the way, I'd love a recommendation for a PHP book similar to Thinking in Java, or Advanced Perl Programming. I've looked, but all I've found are Dick and Jane Learn PHP, or dead tree dumps of the documentation.

      --

      This is the voice of World Control. I bring you Peace.

    4. Re:Like the old saying goes by Lillesvin · · Score: 2, Interesting

      Somehow I can't really make it seven fewer... I've got the same keyword thingy in firefox, but I only save like 5 keystrokes... (?)

      "http://php.net/strings" <-> "php strings" // 15 strokes less (":" is shift-. on Danish keyboards and "/" is shift-7 so 2 strokes for each of them).
      "php.net/strings" <-> "php strings" // 5 strokes less. (".net/" is 6 strokes but there's still a space between "php" and "strings" in the keyword search.)

      But yeah, keywords are great, I've got them setup for wikipedia, mysql.com/doc, php.net, discogs, apache... Everything... Thank you Mozilla-people! :)

      --
      "Live free or don't."
  5. I prefer a different book by RelliK · · Score: 3, Funny

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

    --
    ___
    If you think big enough, you'll never have to do it.
    1. Re:I prefer a different book by Anonymous Coward · · Score: 2, Insightful

      What's wrong with "How to Do Everything with PHP and Postgresql" ?

    2. Re:I prefer a different book by rawyin · · Score: 2, Insightful

      We should author that book.

      MySQL has garnered such popularity because it is EASY. It is unfortunate however that easy does not mean good. MySQL is the Geo Metro of database systems. It's easy to drive and anyone can finance the thing. It pays to note that LAMP is the ultimate driving force behind the movement.

      As a result of this ease and the lack of knowledge needed to make it operational, there are more scripts than one can count that you just drop into a LAMP installation and *bing*, instant website. The security concerns alone make me shudder, but the proliferation of bad code is perhaps just as serious of a problem.

      While I think there are things that MySQL and PHP do quite well together, I would prefer if the development groups spent less time trying to perfect their recipe for "instant website" and instead increased their educational resources and expanded their product to meet standards.

      It would make better netizens of their users. Or at least teach them "no, the world doesn't have padded walls for when your server falls down and gets a booboo."

  6. haha by macaulay805 · · Score: 3, Funny

    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.

  7. One size doesn't fit everything by vlad_petric · · Score: 4, Informative
    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).

    --

    The Raven

    1. Re:One size doesn't fit everything by anthony_dipierro · · Score: 2, Informative

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

      Huh? What is it, then?

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

      Clearly only a problem if you're using those php libraries that aren't thread safe, and even then, the performance increase of threaded apache usually isn't worth the additional programming overhead of dealing with threads - and if you really need to squeeze every ounce out of your boxes that you can you're probably better off not using apache in the first place.

      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).

      I can't imagine a site which is so heavily trafficed that the cost of hardware saved by using jsp vs. php is worth the cost of programmers to program in it. And then, you're probably better off not using apache at all in those situations. Of course, maybe you can find some cheap jsp programmers, but in my experience php is a lot easier to code.

  8. Versions by amembleton · · Score: 2, Interesting

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

    Specifically, does it cover PHP5?

    1. Re:Versions by puppetman · · Score: 2, Informative

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

  9. Most comments to this review by jbellis · · Score: 4, Insightful
    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, J2EE solutions suck just as badly in different ways. (That's another article.)

    1. Re:Most comments to this review by zulux · · Score: 2, Funny


      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.

      --

      Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

    2. Re:Most comments to this review by Jose-S · · Score: 2, Insightful

      It is true that many Java frameworks (and to be specific much of what Sun designs) tends to be over-engineered and complicated. That's not to say that Java the language sucks, or that there can't be simple Java frameworks. In fact, it has been a very successful language for a reason, a language that MS itself has put a lot of effort into cloning (and improving to a limited extent in some areas), and one that IBM is very fond of.

  10. Just now emerging, in 2005? by skoda · · Score: 3, Funny

    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?

  11. Re:bah! by downward+dog · · Score: 4, Insightful

    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."

  12. PHP and MySQL by Anonymous Coward · · Score: 2, Funny

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

  13. Make it stop by glwtta · · Score: 4, Insightful
    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?

    --
    sic transit gloria mundi
    1. Re:Make it stop by nxtw · · Score: 4, Insightful

      I think most people that can write a decent book and that *should* be writing books are smart enough to use a better database than MySQL.

  14. Re:MySQL good, PHP not so good by moonty · · Score: 2, Informative

    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.

  15. I hate the title by diegocgteleline.es · · Score: 3, Insightful

    "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.

    1. Re:I hate the title by AuMatar · · Score: 3, Insightful

      "static content which changes very frequently"

      Doesn't that make it dynamic?

      ANd why not use PHP to implement them? Instead of ftping the file tomy computer, adding my new text, then ftping it back, I can just use a PHP script to add it to a db, and a second script to write it out to the world. Much easier. As someone who did things the bad old way once upon a time, this is a huge time saver.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    2. Re:I hate the title by nxtw · · Score: 2, Informative
      By *dynamic*, they mean content that is somehow generated every time the page is viewed. Examples would be Slashdot, forums, high-traffic news sites, etc.

      ANd why not use PHP to implement them?

      It's unnecessary, that's all. A text or HTML editor with FTP, SFTP, or WebDAV can do the job just as well. And for sites that actually get traffic, it's best to minimize the amount of database hits and processing required to display a page.
      Just because you *can* is not a reason why you *should*. (Now if only I'd think that way while driving...)

  16. Re:both available under open-source licenses? by markybob · · Score: 2, Insightful

    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.

  17. No, buy a SQL book by DogDude · · Score: 4, Insightful

    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.

    --
    I don't respond to AC's.
    1. Re:No, buy a SQL book by njcoder · · Score: 4, Insightful
      " I can't stress strongly enough that people NOT buy a MySQL book. Buy a SQL book. Even better, buy a RDBMS book."

      If people start doing that.... I can't see people still using MySQL :)

    2. Re:No, buy a SQL book by DogDude · · Score: 2, Informative

      But MS SQL and DB2 don't deserve to be linked into the same category.

      I was actually giving Postgre the benefit of the doubt by lumping it in with SQL Server and DB2. I've never used it, but I've heard good things about it. I was planning on giving it a shot once a version of Toad came out that supports it.

      --
      I don't respond to AC's.
    3. Re:No, buy a SQL book by njcoder · · Score: 2, Interesting

      I haven't used Toad for a while as I've been using PostgreSQL more now and haven't used Oracle in a while. So I can't compare the current versions of Toad to other products. PGAdmin3, which installs if you install PostgreSQL on windows. Probably not as good as Toad but you can do most of the things you'd want to. Also tools like CaseStudio are good modelling tools that work with PostgreSQL. I'm still looking for a good open source data modelling tool that can reverse and forward engineer with PostgreSQL.

    4. Re:No, buy a SQL book by dingfelder · · Score: 2, Informative

      toad does more than oracle now

      their mysql admin tool rocks
      http://www.toadsoft.com/toadmysql/toad_mysql.htm

      they also have a sqlserver version now too
      http://www.toadsoft.com/toadsqlserver/toad_sqlserv er.htm

      If you use mysql, oracle or sqlserver you are missing out if you have not tried toad.

  18. It was the language and not the code? by Wee · · Score: 3, Insightful
    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. 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

    --

    Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.

  19. Re:MySQL good, PHP not so good by hobbesx · · Score: 3, Insightful
    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...)

    --
    This rating is Unfair ( ) ( ) Fair (*) Funny
    Sigh... If only. Modding would be so much more fun.
  20. Re:You forgot... by a1cypher · · Score: 2, Informative

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

  21. Melonfire by MikeMacK · · Score: 3, Funny

    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?
  22. Re:both available under open-source licenses? by Al+Dimond · · Score: 2, Informative

    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...

  23. Re:both available under open-source licenses? by svallarian · · Score: 4, Insightful

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

    Not very free IMHO.

    --
    I patented screwing your mom. But it got revoked for "prior art."
  24. Not entirely correct by Safety+Cap · · Score: 2, Informative
    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).

    --
    Yeah, right.
  25. Brilliant! by Soong · · Score: 2, Insightful

    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.)

    --
    Start Running Better Polls
    1. Re:Brilliant! by deuterium · · Score: 5, Insightful

      I'm working on a simulator that involves large amounts of data, and originally started work with MySQL. It's so popular that I assumed it was the easiest to use. Since our product is sold as a workstation, I quickly realized that each unit would cost us $200 for the MySQL server. A quick search uncovered PostGres, which has really turned out to be just as easy to use, is free, and even has a .NET interface and simple administrative utility. Pretty nice. I don't know if it's slower than MySQL, but it's plenty fast for me. You can even do transaction processing. It's strange that even though PostGres is so old, there are almost no books available for it (aside from the Douglas text), while MySQL has dozens.

  26. Re:bah! by Decaff · · Score: 2, Insightful

    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.

  27. Perl and PostgreSQL by stlhawkeye · · Score: 4, Funny

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

    --
    "I have never won a debate with an ignorant person." -Ali ibn Abi Talib
    1. Re:Perl and PostgreSQL by Leroy_Brown242 · · Score: 4, Insightful

      s/retard/genius/

    2. Re:Perl and PostgreSQL by imroy · · Score: 2, Insightful

      Here here! My variation of the "LAMP" acronym is Linux, Apache, Mason, PostgreSQL. Working pretty damn well for me. I've been looking at AxKit on and off for a while, but who wants to use "LAAP"? :P

    3. Re:Perl and PostgreSQL by bluGill · · Score: 4, Interesting

      If that is for historical reason you are smart. PostgreSQL has always been a better database than MySQL. Perl is the old standby for web development. However today Ruby and Python have both proven themselves better languages, in that you have a good chance of reading and understanding your code latter when you need to maintain it. Therefore I have to suggest you evaluate them both, and choose one for jobs that don't have historical reasons to use perl.

      Don't waste your time on PHP. It is better than Perl, but not by enough to be worth the pain.

  28. PHP editorfor Linux, anyone? by bogaboga · · Score: 2, Informative
    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/, are not good enough. I want one I can get for free.

    1. Re:PHP editorfor Linux, anyone? by Anthony · · Score: 2, Informative

      You've tries all the free ones? Including Eclipse? Perhaps you'd like to write a review yourself. I noticed my PHP editor of choice is not on the list. GNU Emacs. It naturally has a PHP-mode.

      --
      Slashdot: Where nerds gather to pool their ignorance
    2. Re:PHP editorfor Linux, anyone? by terrencefw · · Score: 4, Informative

      Not trolling... I code PHP for a living. I maintain a codebase of around 750,000 lines of complicated legacy code.

      I use vim, but make sure you set ctags up.

      --
      Like tinyurl, but one letter less! http://qurl.co.uk/
    3. Re:PHP editorfor Linux, anyone? by Ucklak · · Score: 2, Insightful

      Eclipse with PHPEclipse Plugin.

      Invaluable and the CVS integration makes it even better.

      I run it on (seriously) on Windows (Work), Linux (Home), Mac (Laptop) and don't skip a beat.

      --
      if you steal from one source, that is plagiarism, if you steal from many, well, that's just research.
  29. QUIT emacs?!? by PlacidPundit · · Score: 2, Funny

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

  30. Re:both available under open-source licenses? by EvanED · · Score: 2, Interesting

    BSD is more free than GPL.

    There is not one thing that you can do under the GPL that you are not allowed to do under the BSD license, and there is quite a bit more you can do under BSD.

    That is pretty much the definition of "more free" under any definition of "free" that applies to this disucssion (e.g. is not the same as "gratis").

    Now, the questions of whether the BSD license or GPL leads to more software freedom and which license promotes free software better are up for some debate. The GPL makes sure the software STAYS free, and as such, there are very good arguments that the GPL better promotes free software, the OSS movement is better off than if everything was released BSD, etc. But this is a different matter than which license is more free. If the promotion idea is what you are thinking when you say the GPL is more free, I put to you that you need to be less sloppy with your language and say what you mean, not what sounds good.

  31. [OT] Re:PHP editorfor Linux, anyone? by gregmac · · Score: 3, Informative

    If anyone can point me to a good *free* PHP editor for Linux, I'd be very glad.

    Kate

    Has syntax highlighting (including recoginizing builtin functions), bracket matching, code folding, regex search and replace, blah blah.

    If you want one that does fancier stuff like show you class structures etc, then I dunno. Eclipse has a PHP plugin I heard - dunno how it works. One of my friends is huge into zend studio (non-free), but he works at a university (where they think nothing of spending a students tuititions worth on a computer - what do you mean our programmers don't need 23" apple cinema displays?)

    --
    Speak before you think
  32. Great Book! by po_boy · · Score: 5, Funny

    I\'ve just read this book, and it\'s great! I\'m going to use PHP and MySQL for all of my web-based apps now!

  33. PHP encourages bad code. by Some+Random+Username · · Score: 2, Insightful

    In fact, look at the zend website even, they give horrible examples that nobody should ever follow. Gee, I wonder why so many PHP programmers end up writing crappy code.

    Also, the PHP developers have proven over and over again that they do not care AT ALL about security. As an ex-PHP programmer myself, I have to agree with the "dear god use anything but PHP" people.

  34. Risk of SQL injection by the_european · · Score: 5, Insightful

    Look at the examples given in the companion web site. There is code like the following, which is highly vulnerable to SQL injection attacks:

    $title = $_POST['title'];
    $content = $_POST['content'];
    $contact = $_POST['contact'];

    // validate text input fields
    if (trim($_POST['title']) == '')
    {
    $errorList[] = 'Invalid entry: Title';
    }

    Validate? Just by removing trailing spaces? People trusting this book's advice will be very sorry soon.

    // and later in the script ...

    $query = "INSERT INTO news(title, content, contact, timestamp) VALUES('$title', '$content', '$contact', NOW())";
    $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

    One more example:

    // generate and execute query
    $id = $_GET['id'];
    $query = "SELECT title, content, contact FROM news WHERE id = '$id'";
    $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

    No validation at all! User input thrown into the database without any check!

    It's unbelievable that in 2005, after all the outrage and cry about SQL injection ther is still a new book proposing such horrible code!

    1. Re:Risk of SQL injection by Santana · · Score: 2, Informative

      This can be useful for you.

      --
      The best way to predict the future is to invent it
  35. Re:Is that Realistic? by Anthony · · Score: 2, Informative

    Yahoo employ Rasmus Lerdorf. He is the author of PHP. They use a lot of front end servers. See here for an architecture discussion.

    --
    Slashdot: Where nerds gather to pool their ignorance
  36. Is Mason there yet? by otis+wildflower · · Score: 2, Interesting

    I mean, I know that apache2 support is only available in CVS, but other than that, how's it compare to php?

    I just wrote a bunch of php with PEAR DB and compared to perl it felt.. unclean.. hashes and regexes are unpleasant compared to perl, and I couldn't subclass DB cleanly since it has no constructor..

    Granted, I could get stuff done pretty quickly because php is perl-like, but there's enough stuff that seems arbitrarily different from perl to make the experience sorta yucky.

  37. Re:You forgot... by nxtw · · Score: 4, Informative
    They aren't the default table type, though.

    PostgreSQL, SQL Server, Oracle, and many other database systems (including commercial and open source) have been ACID compliant for quite some time. Not to mention the abundance of features that other database systems have, like stored procedures, triggers, views, subselects, etc. Many of those features have not yet made their way into MySQL and may not until 5.1; some have been recently added to production releases; others are still in "5.0" beta.

    Even then, data integrity and features have never been a primary concern of MySQL developers.
    Access manages to beat MySQL; MySQL completely chokes (for whatever reason) on joins that Access handles in seconds. SQL Server, PostgreSQL handle these queries fine.

  38. Reasons PHP and MySQL are popular by loudmax · · Score: 2, Interesting

    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.

    These are valid reasons for their being popular, but the reviewer left out another very important reason: both of them are really easy to learn. Whatever their shortcommings, someone with only moderate technical inclanation or experience can learn enough PHP and MySQL to have a fairly powerful site up and running in a very short amount of time.

    --
    KTHXBYE
  39. Re:How to make Php and MySQL do anything... by cranos · · Score: 2, Funny

    This is why I use Postgres, that and the amazing thing it can do with its tongue :)

  40. Re:"JSP in a very light manner" by Decaff · · Score: 3, Insightful

    Tomcat must have progressed quite a bit in the last 5 years then.

    It certainly has. Especially in terms of performance. The latest Tomcat (5.5) approaches the speed of Apache in some cases.

    Yes, you could run Tomcat on port 80, with no Apache, but I seem to recall that Tomcat specifically leaves out much of the functionality that Apache does natively- perhaps lock something down by IP, etc.

    This is all available now (RemoteHostValve, RemoteAddrValve etc).

    Once you've gone through the nightmare of setting this up properly, you then get to learn Ant to make your WARs. While I did find Ant appealing/nice/whatever, it's quite a bit more complex than you're making it up to be to be serving up .jsp.

    The latest versions of NetBeans (4.0, 4.1) does this for you. Every change to a J2EE project automatically updates your WAR file. It even (again automatically) writes and maintains Ant scripts so that you can do this from the command line as well.

    I do feel a lot of the criticism of Java/JSP/J2EE is based on the way things were years ago. This have changed a lot!

  41. Hmm, sounds like the J2EE guy by MichaelPenne · · Score: 2, Interesting
    still doesn't get PHP:-).

    "Ultimately think this a showdown between "Process / Fork" (LAxP) vs. "Runtime / Thread" (J2EE / .NET). When asking "does PHP scale?" you're really asking "does Process / Fork + X persistent store scale?".

    In many ways that questioning whether *Nix scales..."

    By the way, some yahoo is using PHP for one of the most highly trafficked sites in the world, how about that?
  42. Re:You forgot... by Osty · · Score: 5, Interesting

    They aren't the default table type, though.

    Worse than that, if the table type isn't available and you try to use it, MySQL doesn't fail. It'll happily go on, ignoring that you asked for InnoDB tables with ACID compliance, and pretend that it's actually doing something when you ask it to open/commit/rollback a transaction. This is one of those "user friendly" features that really isn't, and MySQL has a bad habit of doing crap like this. If I want a table of a certain type, and that type isn't available, the DDL should cause a failure. It shouldn't succeed silently, choosing a different table type than what I asked for.

    Not to mention the abundance of features that other database systems have, like stored procedures, triggers, views, subselects, etc. Many of those features have not yet made their way into MySQL and may not until 5.1; some have been recently added to production releases; others are still in "5.0" beta.

    Don't forget, implementing those features will make MySQL slow! Real programmers don't need them! Well, not until MySQL implements them, anyway (wait, I thought implementing them would make MySQL slow? They's gots some kind of magic that can keep MySQL fast after implementing features that'll make it slow? Well hot damn!).

    Features come and go, and I have no doubt that the MySQL developers will continue to advance MySQL until it can effectively mimic a real RDBMS. The lack of features is just an additional reason to complain about MySQL. The real reason why Those Who Know Better (tm) give them so much shit is the developers' attitudes, that they think they know so much more than development houses that have spent 20+ years researching and building real RDBMS engines (Oracle, IBM, and even Microsoft). If MySQL developers would've just said something along the lines of, "We understand the importance of foreign keys for proper referential integrity enforcement, but we have other priorities right now and want to make sure that when we do implement foreign keys that we do so in a robust and performant way," I wouldn't have ever had a problem with MySQL lacking foreign key support (just used as an example). Instead, they had an attitude like, "You don't need foreign keys. If we implemented them, they'd slow down MySQL, and besides, if you're a good enough developer you can compensate for the lack of foreign keys in your application code." That attitude earned them the scorn and distrust of anybody who knows anything about RDBMS design and usage.

  43. everything? by mrselfdestrukt · · Score: 2, Funny

    I tried to copulate with my G/f using php and mysql. It failed miserably. :-(
    use girfriend;
    show rack;
    select * from rack;
    insert into ... *CRASH!!!*

    --
    "I used to have that really cool,funny sig ,but it got stolen."
  44. Re:buy a MySQL book by Decker-Mage · · Score: 2, Interesting
    Sorry but I find MySQL user (programmer) hostile, only (somewhat SQL-92) standards compliant, somewhat fast in some instances providing you live within their SQL implementation, and more than something of a security nightmare as many default settings are idiotic, to say the least.

    Now, supposedly, all will be magically better in 5.0 when it goes gold. I'm in wait and see mode. However, as a database engineer who is totally database agnostic (heck, everything agnostic), it still needs more than a bit of work. Then that's true of most of the industry.

    Security? Standards? We don't need no stinkin' (insert here).

    To get back to the review, these books are nice but not the whole answer and I have a real problem with any book that states in the title "How to do anything with...". Sorry, but I'm not someone that restricts myself to any one toolbox when it comes to creating applications, be it on the web, the server, or the desktop. I use, simply put, the best tool for the job, period. To paraphrase, when you only have a hammer, everything looks like a nail, and that is far too true of the the IT industry. I pick the tools to suit the job at hand, not the job at hand to suit the tools, or to force fit the job to match the tools.

    PHP is nice (heck, very nice). MySQL is nice, and often speedy, but still needs more than a bit of work (although 5.0 and native XML support would make it beautiful, IMNSHO). Force-fitting everything into that paradigm is right up there with the morons that say Java can do anything, anytime, and better.

    Not that I have anything against Java (yeah, right).

    --
    "[I]t is a wise man who admits the limits of his knowledge or skill, and that pretending either causes harm." --Terry Go
  45. Re:buy a MySQL book by crucini · · Score: 2, Insightful

    While I partially agree, I have to mention the counterpoint. MySQL is very good across a certain domain of problems. Where I work now, we pick between Oracle and MySQL for specific projects. If we don't see transactional requirements, writer contention, or huge volumes of data, we pick MySQL. It's faster and generally easier to work with.

    I just don't care that MySQL isn't SQL-92 compliant. By the way, none of the applications I have worked on on Oracle could be trivially ported to a different db, standards or no. I agree that MySQL is friendlier than other dbs. Most obvious example - meaningful error messages.

    I am not excited by Innodb or most of the features being added to MySQL. These changes, which add Oracle-like capabilities, also add Oracle-like problems, such as complexity, slowness, lock buildups, etc. We already have Oracle. We use MySQL where it fits.

    As for hammers and nails: the guy with only one tool has a problem; so does the guy who spends all his time learning new tools and never becomes expert with one. There is not a logical niche for every technology - many of them are not worth touching, period. It's better to invest time in learning a few tools deeply.