Slashdot Mirror


Beginning PHP and MySQL 5.0

Ravi Kumar writes "PHP and MySQL use is so prevalent that nowadays it is hard to miss seeing a website on the net which has been built using these technologies. The beauty of PHP is in its open nature and the rich set of libraries and modules which imparts a lot of power and flexibility to the programmer. Similarly MySQL is a free database which is ideal for use as a backend for any website. And not surprisingly there are a plethora of books in the market which explains these two topics. One such book is Beginning PHP and MySQL 5 from Novice to Professional authored by W.Jason Gilmore published by Apress." Read the rest of Ravi's review. Beginning PHP and MySQL 5.0 - From Novice to Professional author W.Jason Gilmore pages 860 publisher Apress rating 9 reviewer Ravi Kumar ISBN 978-1-59059-552-7 summary The beauty of PHP is in its open nature and the rich set of libraries and modules which imparts a lot of power and flexibility to the programmer. Similarly MySQL is a free database which is ideal for use as a backend for any website.

Spread over 860 pages and divided into a whooping 37 chapters, this book covers the PHP Language and MySQL database in detail. As the name indicates, the book endeavors to hand hold a newbie in the various aspects of PHP programming like the language constructs and progressively brings him to the level of a professional. The first 21 chapters of the book solely concentrates on PHP where the author explains with the aid of examples how to write good programs in PHP.

The author starts the narration by giving a brief history of PHP and then moves on to explain all the syntax constructs of this language in great detail. Arrays, functions and classes have each been provided separate chapters of their own. Usually I have found many books related to programming jumping straight into describing the language syntax and about writing code. But this book has a dedicated chapter each covering how to setup and configure PHP and MySQL on ones machine irrespective of the OS being used which breathes some fresh air to this subject. PHP language has a very good similarity with C/C++ at-least in the syntax. And in the sixth chapter, the author explains the Object Oriented Concepts like object cloning, inheritance and polymorphism of this language with clarity.

The maturity of any programming language is gauged by the type of traps that it has developed to check the errors and exceptions that might be generated dynamically when a program is run. PHP has a rich set of features for handling errors. Earlier versions of PHP already took care of notifying errors through configuration directives and support for logging. But one thing this robust language lacked was support for exception handling. And from PHP ver 5.0 onwards, this feature has also been included in it. The 8th chapter in this book titled Errors and Exception Handling explains all these important concepts in detail. The fact that the author has provided snippets of code to illustrate each concept that is explained goes a long way in understanding this topic.

Another of PHPs strengths is in its support of a rich set of regular expressions and string manipulation functions. Using regular expressions, one can match just about any string or a sub-set of it and even do manipulations to the matched string on the fly. The string matching functions form the backbone of many user input validations. In the 9th chapter titled "String and Regular Expressions", the author explains with the aid of code how to use the rich set of string manipulation functions available in PHP to get the desired results.

The 10th chapter is solely dedicated to working with files and operating systems where the author explains in his inimitable style different ways of reading from and writing to files. All the frequently used file manipulation functions are explained in this chapter with the aid of examples.

The first 12 chapters of the book solely concentrates on explaining the PHP language to the readers. In the next 4 chapters, the author moves into practical aspects like explaining how to mix PHP with HTML elements, user authentication , handling file uploads, sending and receiving email using PHP code and so on. I found the section where the author explains how to build specialized programs such as a port scanner, subnet converter and bandwidth tester all with the aid of PHP code really fascinating. The author introduces the reader to some of the MySQL concepts in this part of the book like connecting to a database and reading data from database but the more detailed aspects of database manipulation are left for later chapters which deals with MySQL in more depth.

The 21st chapter titled Secure PHP programming throws light on topics related to enhancing security while coding in PHP such as enabling safe mode for people who run PHP in a shared-server environment, PHP's encryption capabilities, securely configuring PHP via its configuration parameters and so on.

From the 22nd chapter onwards, the book takes an all together different turn and moves into explaining the database concepts which plays an important part in any dynamically generated website. More specifically, the succeeding chapters concentrate on explaining the configuration and use of MySQL 5.0 and how one can use PHP to interact with the MySQL database. The chapter titled Introducing PDO throws light on the abstraction layer used between PHP and MySQL. I especially liked the 26th chapter where the author lists the different MySQL clients which are available to the user like mysql, mysqladmin, mysqlshow and so on. In fact, each and every tool which comes bundled with the mysql server is explained thoroughly with the aid of examples. But that is not all, this chapter also explains how to configure a mysql database using third party clients like PHPMyAdmin, MySQL Query Browser, MySQL Administrator and Navicat. In the section on securing MySQL, the author goes into the finer nuances of the topic. For example, with the aid of commands, the author explains how to make sure that the user connects with the database over secure sockets layer (SSL) or ways of encrypting the MySQL database traffic which is an eye opener.

But I would say the 29th chapter titled PHP's MySQL Extension is the most important chapter in the entire book just because it is in this chapter that the author explains in detail the variety of ways in which one can connect to MySQL database and retrieve or manipulate the data using PHP code.

In the 30th chapter titled PHP's MySQLi Extension, one gets to know how to use the enhanced MySQLi extension to connect to the database. The MySQLi extension contains more enhancements over its predecessor in that it is object oriented, supports prepared statements, provides transactional support, has better debugging capabilities among other things. But the down side as the author puts it is that it requires PHP 5.0 for it to work.

The last six chapters deal with special features of MySQL and how one can write PHP code to use those features. The features like stored routines, MySQL triggers and Views have been provided with a dedicated chapter of their own. And yes, from MySQL ver 5.0, support for views have also been incorporated in the database. And the fact that this book covers these new topics in detail makes this a truly useful book not only for budding programmers but also for the gurus among us.

I really liked the layout of the book. Each section is accompanied by PHP code snippet which shows how it is done. Just because one gets two books at the price of one does not mean that the book is short on detail. In fact the opposite is true and the 860 pages contain all that is needed for coming upto date with the latest version of PHP and MySQL. Of course the inclusion of a couple of pages giving a complete project such as a shopping cart application at the end of the book would have imparted a nice touch especially since this book is targeted at beginners too. But that is a minor detail and I guess there are limits to which a books of even this size can cram information. All in all an informative book which gives good value for money.

The author of this book W.Jason Gilmore has developed countless PHP and MySQL applications over the past seven years, and has dozens of articles to his credit on this and other topics pertinent to Internet application development. He has had articles featured in, among others, Linux Magazine and Developer.com, and adopted for use within United Nations and Ford Foundation educational programs. Jason is the author of three books, including most recently the best-selling Beginning PHP and MySQL: From Novice to Professional, and, with coauthor Robert Treat, Beginning PHP and PostgreSQL 8: From Novice to Professional. These days Jason splits his time between running Apress's Open Source program, experimenting with spatially enabled Web applications, and starting more home remodeling projects than he could possibly complete.

Ravi Kumar is passionate about all things related to GPL and open source and likes to share his thoughts through his blog."

You can purchase Beginning PHP and MySQL 5.0 - From Novice to Professional from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

142 comments

  1. Misleading Title by michaelhood · · Score: 4, Insightful

    That is a very poor title. Is the book about PHP 5 and MySQL 5? or PHP 5 and MySQL 4?

    1. Re:Misleading Title by op12 · · Score: 2, Informative

      From this review, it looks like it's version 5.0 for both, which probably explains the title. But it is unclear if that's the case from just the title.

    2. Re:Misleading Title by Anonymous Coward · · Score: 0

      I thought the title was "Beginning PHP and MySQL 5.0" ...maybe you meant PHP 4 or 5?

    3. Re:Misleading Title by KermodeBear · · Score: 1

      The title is also misleading because no book will ever turn you into a professional PHP developer. Someone who is new to programming and reads this book is still likely to make newbie mistakes - mistakes that they would make in ANY programming language.

      Incorrect data validation; Inappropriate use of resources; Inelegant design; Bad debugging methods; Using the wrong tools for the job. All of these and more are things that you really won't learn from a book. You learn these through experience.

      Any book that promises to turn you into a 'professional', to me, has a strike against it before I even turn past the cover.

      --
      Love sees no species.
    4. Re:Misleading Title by Anonymous Coward · · Score: 0

      The correct title is Beginning PHP and MySQL 5: From Novice to Professional, Second Edition. See the publishers page: http://www.apress.com/book/bookDisplay.html?bID=10 017

    5. Re:Misleading Title by Bastard+of+Subhumani · · Score: 1
      The title is also misleading because no book will ever turn you into a professional PHP developer. Someone who is new to programming and reads this book is still likely to make newbie mistakes
      I agree infinitely. No, double that.
      Incorrect data validation; Inappropriate use of resources; Inelegant design; Bad debugging methods; Using the wrong tools for the job. All of these and more are things that you really won't learn from a book. You learn these through experience
      I agree even more than infinitely. More than double infinitely. I mean, it's not like you could learn any of that stuff from having 15 years experience in five or so other languages, is it?
      --
      Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
    6. Re:Misleading Title by flimflammer · · Score: 1

      Well of course the title is misleading. It's as misleading as "Sams Teach Yourself C++ In 21 Days!" - The title is nothing more than an attention grabber, and it works rather well too.

    7. Re:Misleading Title by Anonymous Coward · · Score: 0

      The title is also misleading because no book will ever turn you into a professional PHP developer.

      To be fair, nothing will turn you into a professional PHP developer, because there is no such thing. HTH.

    8. Re:Misleading Title by Aeros · · Score: 1

      I think you should have IQ points taken away for wasting time, spacing and characters with that comment.

    9. Re:Misleading Title by Aeros · · Score: 1

      So maybe this should be "Beginning PHP and MySQL 5.0 (both) - Words to read to begin to Begin" Ok...I know someone will bitch abut something embedded in that title somehow

  2. LAMP Rocks by celardore · · Score: 3, Interesting

    When I was learning programming from the age of 12, I was 'developing' Windows apps, for various purposes. After PHP / MySQL had been about for a while, I picked those up. I dropped any windows development I did - just because it didn't interest me anymore with this exciting thing going on. I would and have suggested to a lot of newcomers to coding that they look into PHP, and a lot of them did with some success.

    You can do some incredible stuff with PHP/MySQL if you put your mind to it. One of my favorite projects (it wasn't the definitive or only one!) was a windows app that hooked keypresses. Every so often it would upload the number of keypresses to some PHP / MySQL code and update your user profile.

    The application potential is impressive, and not fully exploited the way I look at it.

    1. Re:LAMP Rocks by entrylevel · · Score: 4, Insightful

      I prefer the LAMP camp myself, as opposed to the ASP.NET/SQL Server camp, which I assume is what you meant when you compared LAMP to "Windows development".

      However, although I'm the first to brag about the power, simplicity, and performance that PHP and Apache offer when used by the right programmer, I do make a living off of ASP.NET/SQL Server applications, so please consider the following in the ensuing flamewar:

      1. PHP is an extremely flexible scripting lanuage, that really excells at what it does: powering the back-end of a web application and interfacing with databases and the file system. Trying to make PHP do other things is possible, but is almost always a nasty hack.

      2. The .NET Framework and CLR although sometimes misunderstood and often misguided, is really one of the best general purpose development environments bar none right now. It does web applications just as well as it does desktop and console applications. ASP was truly idiotic and horrid, but ASP.NET is very mature and worth an unbiased look if you aren't familiar with it. Then again, there is MSDN documentation and VB programmers, which tend to cancel out anything good I could say about .NET.

      3. Say what you will about SQL Server, but if we could just replace the M in LAMP with PostreSQL, or, well, anything other than MySQL, I would be happy. SQL Server is not my favorite database, but it is very good. MySQL has its niche, but I expect a RDMS to have stored procedures and transactions as standard fare.

      (yes, I know 5.0 has SPs, and InnoDB gives you transactions, but I said "standard fare")

      4. This is the most important point of all: There are just as many cookie-cutter, craptastic, insecure, bug-ridden PHP apps out there as there are ASP.NET apps. On the other hand, if you are smart and creative, and truly use the tools provided by either platform, you can create fantastic applications with either one, just as easily.

      --
      Karma: Incomprehensible (Mostly affected by posting at +5, reading at -1, and metamoderating everything unfair.)
    2. Re:LAMP Rocks by Anonymous Coward · · Score: 0

      I couldn't agree enough. I work for a fairly large telecommunications firm and we have used LAMP for years now. We recently found the opensource project, ActiveGrid http://www.activegrid.com/. This goes way beyond an IDE, but is a very useful way to rapidly build, manage and deploy numerous application within a large scale enterprise. That had been my biggest complaint until now, the lack of tools around LAMP. And, yes, we are big enough that we must have support contracts to do any type of large rollout of a technology. For my money, this was a great investment. You might consider looking for LAMP IDE in google to find some others.

    3. Re:LAMP Rocks by jt2377 · · Score: 1

      "ut ASP.NET is very mature and worth an unbiased look if you aren't familiar with it. Then again, there is MSDN documentation and VB programmers, which tend to cancel out anything good I could say about .NET." LOL. VB.net is not your grandpa's VB, son. stop talking out of your ass.

    4. Re:LAMP Rocks by hobuddy · · Score: 4, Insightful

      PHP is an extremely flexible scripting lanuage, that really excells at what it does: powering the back-end of a web application and interfacing with databases and the file system. Trying to make PHP do other things is possible, but is almost always a nasty hack.

      Help me out here: you're saying that PHP is extremely flexible, as long as the programmer only tries to write one type of program with it? Hmmmm?

      I think we both recognize the truth: compared to Python, Ruby, or Lisp, PHP is not very flexible at all. It's a poorly designed, inflexible language that happens to have gained momentum at a critical era in the history of the WWW.

      --
      Erlang.org: wow
    5. Re:LAMP Rocks by entrylevel · · Score: 1

      I didn't say VB.NET, I said VB programmers and MSDN documentation.

      VB.NET is a fine language, if a tad verbose for my taste.

      My problem is not with the language. My problem is with the swarms of morons churning out God-awful code using said language.

      --
      Karma: Incomprehensible (Mostly affected by posting at +5, reading at -1, and metamoderating everything unfair.)
    6. Re:LAMP Rocks by Sentry21 · · Score: 2, Insightful

      (yes, I know 5.0 has SPs, and InnoDB gives you transactions, but I said "standard fare")

      What does this even mean? You know that they are available, but you don't want to use them? You don't support using the latest versions? You seem to want to imply something, but I can't figure out what it is.

    7. Re:LAMP Rocks by entrylevel · · Score: 1

      My point about MySQL is that many components that people consider to be part of any Relational Database Management System (ACID-compliance, referential integrity, single-level local transactions, and a method to abstract database server logic into methods with parameters), were not design tenets of MySQL. They all feel like an afterthought, and require some effort to get working, instead of being the default.

      As an example, I seem to remember that FOREIGN KEY REFERENCES was silently ignored in MySQL with the default table type, instead of at the very least issuing a warning that the desired data integrity feature is not available.

      Yes, all these things are (mostly) implemented now, and they are standard in MySQL 5. However, most hosting providers are not currently offering MySQL 5, and most applications were designed with MySQL 4 or lower in mind, which means you have to basically turn off "strict mode" in MySQL 5 to run old code or target old servers. Disabling strict mode effecively turns off all the benefits we just proclaimed in MySQL 5.

      My point is this: MySQL is great for someone who is learning, and good to know because it is ubiquitous, however it is not the choice of database for database people.

      --
      Karma: Incomprehensible (Mostly affected by posting at +5, reading at -1, and metamoderating everything unfair.)
    8. Re:LAMP Rocks by Anonymous Coward · · Score: 0

      Having suffered with lisp from time to time my opinion is that Lisp is not a flexible language nor is it readily de-bug-able. What I really hate about lisp is it's inherent un-readability. Crd & car must die! I refuse to use emacs because it uses lisp as a scripting language. What a yuck fest that is.

    9. Re:LAMP Rocks by Dirtside · · Score: 1
      I think we both recognize the truth: compared to Python, Ruby, or Lisp, PHP is not very flexible at all.
      Could you perhaps elaborate on how PHP is inflexible? As far as I know, all four languages are Turing-complete and you can accomplish the exact same things in all of them. Are you including their standard libraries, or what?
      --
      "Destroy science and religion. Science would re-emerge exactly the same; but not religion." - Penn Jillette, paraphrased
    10. Re:LAMP Rocks by MBGMorden · · Score: 1

      This I agree with. My final major CS assignemnt in college was to write a LISP interpreter using a programming language of my choice (which was difficult, but very rewarding in the knowledge gained). I basically learned LISP so that I could write the interpreter for it (which itself I wrote in C++), and also learned that I quite thoroughly hated LISP, much moreso than any other language I had used before (and I've dabbled in a lot of different languages).

      When I got done though it was complete with all the basic functions built in, along with the ability for the user to define and call their own functions.

      --
      "People who think they know everything are very annoying to those of us who do."-Mark Twain
    11. Re:LAMP Rocks by WilliamSChips · · Score: 1

      You're kidding me, right?

      --
      Please, for the good of Humanity, vote Obama.
    12. Re:LAMP Rocks by Dirtside · · Score: 1

      Yes, I'm serious. Please answer the question.

      --
      "Destroy science and religion. Science would re-emerge exactly the same; but not religion." - Penn Jillette, paraphrased
    13. Re:LAMP Rocks by 1110110001 · · Score: 1

      Maybe after 5 years it's time for you to look at the language again. And you should also take a look at the languages you mentioned - you'll find enough inflexibility in all of them (including PHP). Most of the time is the upgrade issue haunting them. If they'd just drop mistakes they once made they could also just start a new language.

  3. Actually it's the wrong title. by Anonymous Coward · · Score: 0

    It's Beginning PHP 5 and MYSQL.

  4. I don't want another PHP book by Anonymous Coward · · Score: 2, Interesting

    that tells me how to code PHP. I don't want to learn how to code PHP. I want blocks of code with an explanation of what it does that I can cut and paste into simple webpages that talk to my database. I know how to change variable names using vi, thank you. I don't want to learn this; it will be passe' in a month, dead in a year.

    Whoa, look at the time. Next language/framework/ide please...

    1. Re:I don't want another PHP book by PFI_Optix · · Score: 3, Informative

      PHP Cookbook, published by O'Reilly. I've found it quite useful.

      I believe there's also a MySQL Cookbook, but my database use isn't so advanced that I need specific help on that just yet.

      I'm still learning proper programming technique, while trying to learn PHP and MySQL and the fine points of CSS AND crank out a new web site that won't require a massive rewrite in a year.

      --
      120 characters for a sig? That's bloody useless.
    2. Re:I don't want another PHP book by stesch · · Score: 1

      The factual errors in the "PHP Cookbook" are really depressing.

  5. but but by 0110011001110101 · · Score: 1

    is it Monty Python themed? Because I read no technical book without a Monty Python theme... as we've seen today, it's the only way to get through that technical mumbo jumbo!

    --
    Don't anthropomorphize computers: they hate that.
    1. Re:but but by MindStalker · · Score: 1

      Are there ANY technical books with a Monthy Python theme? I like your idea though and would like to subscribe to your newsletter.

    2. Re:but but by SatanicPuppy · · Score: 1

      Might want to try this one, which was reviewed on /. about 2 hours ago.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    3. Re:but but by 0110011001110101 · · Score: 1
      Why yes, as a matter of fact, and it was the subject of my *attempted* joke.

      Only 3 articles below this very one, is a Monty Python themed technical book... SPOILER WARNING: it sucks.

      Henry's Python Programming Guide

      Good luck, oh, and I've added you to my newsletter.

      --
      Don't anthropomorphize computers: they hate that.
  6. Sec-exps already know PHP is the beginner's choice by xxxJonBoyxxx · · Score: 0, Flamebait

    Security experts already know PHP is the beginner's choice. See:

    http://www.sans.org/top20/#c3 (Top 20 Vulnerabilities)

    "There has not been a single week during the last year that a problem was not reported in some software using PHP."

  7. Tries to do too much by Jason1729 · · Score: 1

    I prefer to start out with a fairly simple introductory book and also get a good reference book that assumes you know the language. In the case of PHP, I skipped the reference and just visit php.net.

    A book like the one being reviewed tries to do too much. When you're starting out, you don't want a a lot of detailed library stuff getting in the way. Once you've got the basics done, you don't want a book that teaches it like a course, you want a reference.

  8. Re:Sec-exps already know PHP is the beginner's cho by turlingdrome · · Score: 1

    now now, don't blame the language... it's the "programmers" who are to blame for not understanding how to write secure apps. It's only to be expected that such a popular langauge with a low barrier to entry is going attract amateurs who just want to see the end result without having to really understand the finer points of application development.

  9. From the review's summary... by gregarican · · Score: 0, Redundant

    Similarly MySQL is a free database which is ideal for use as a backend for any website. Any website? Uhhhh, not so much. If that is the summary of the review I wouldn't place too much credence in the rating or subsequent factoids.

  10. ROR by ShakaUVM · · Score: 1

    Wait, I thought Ruby on Rails was the trendy new thing that you can't visit a website without seeing?

    Damn kids these days.

    1. Re:ROR by Tablizer · · Score: 1

      Wait, I thought Ruby on Rails was the trendy new thing that you can't visit a website without seeing?

      I think R&R is more common for intranet and B-to-B apps rather than public sites. Thus, you wouldn't see it much browsing around public blogs etc.

  11. How does this book compare to.. by op12 · · Score: 2, Interesting

    Does anyone know how this compares to "PHP and MySQL Web Development"? It seems like both cover PHP5 and MySQL 5.

    1. Re:How does this book compare to.. by SatanicPuppy · · Score: 1

      Welllllll, and this is my own opinion here, but I wouldn't buy either one. There are so many free php/mysql resources, you're pretty much going to be throwing your money away unless you really don't know anything about programming languages or relational databases.

      Php.org has got some great language resources. mySQL.com...eh, not as good, but decent if you have a basic grasp of SQL.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    2. Re:How does this book compare to.. by gfxguy · · Score: 1

      When I'm without my books, looking online is a great alternative, but it's a lot easier to say "well, I want to do this," then look up this in the book where everything is clearly and concisely (one would hope) put together.

      I go a lot faster with a good reference book then I do hunting online.

      --
      Stupid sexy Flanders.
    3. Re:How does this book compare to.. by simscitizen · · Score: 1

      I have both. Get the one you linked--the one reviewed is like reading a reference manual. Page after page of function documentation--well, php.net is better for that. Waste of $.

    4. Re:How does this book compare to.. by carlislematthew · · Score: 1

      PHP.NET? Cool! I didn't realize that Microsoft had done this. Is this the replacement for C#? (before you reply telling me I'm an idiot, it's a joke. yes, I'm talking to you)

    5. Re:How does this book compare to.. by Anonymous Coward · · Score: 1, Interesting
      PHP.NET? Cool! I didn't realize that Microsoft had done this. Is this the replacement for C#? (before you reply telling me I'm an idiot, it's a joke. yes, I'm talking to you)
      Not Microsoft, and not a replacement, but it's indeed funny to see a hackish hobby project trash the hell out of PHP's performance even with all the Zend and Roadsend bells and whistles:

      http://www.phpcompiler.net/
      http://www.phpcompiler.net/Benchmarks.htm

      Of course, once you venture into the native VB.NET/C# land, you can expect performance to improve tenfold.
  12. Owner of previous edition by acreman · · Score: 4, Informative

    I personally bought the previous edition of this book. It dealt with PHP 5 and MySQL 4. I learned quite a bit in only a short time. This book helped me finish my capstone project for my engineering degrees. I recommend this book to anyone who is starting off in programming web material and anyone who wants to learn PHP 5 relatively fast. As for MySQL it covers mainly how to connect to a MySQL database using PHP and does not cover in detail how to perform SQL queries.

    1. Re:Owner of previous edition by PietjeJantje · · Score: 1

      Hints: Marketeze, First Post...

  13. Forgot something else... by gregarican · · Score: 1
    From the first sentence of the review: Spread over 860 pages and divided into a whooping 37 chapters. Not whopping but whooping. It sounds as if reading over this volume will leave the reader with an infectious disease and annoy their cubicle neighbors to no end.

    Why is it most of these reviews sound like grade school current events reports?

  14. Prevalent != Best by Soong · · Score: 1

    Remember, Windows is the prevalant desktop operating system.

    Examine the options in the tools available to you, pick what works for you.

    I've tried MySQL and PHP and mod-perl and CGI and python, but my current favorites are PostgreSQL and Tomcat hosting Java Servlets. No books required, their included documentation is quite good.

    --
    Start Running Better Polls
  15. Re:Sec-exps already know PHP is the beginner's cho by xxxJonBoyxxx · · Score: 1
    "don't blame the language... it's the "programmers" who are to blame for not understanding how to write secure apps."

    Hmmm...I thought that's what I said (although there have been some pretty bad holes in the core PHP bits themselves). On the other hand, "dumb entry-level programmers" was also one of the main knocks against IIS's ASP in its early days. (ASPX seems to have largely fixed this by being much less friendly than ASP to entry-level types.) ;)

  16. persistent problem by b17bmbr · · Score: 5, Interesting

    The first 21 chapters of the book solely concentrates on PHP where the author explains with the aid of examples how to write good programs in PHP.

    this is a persistent problem with all of these programming in ____________ books. They teach the language and sometimes get around to dealing with good programming. Learning PHP, or java, or python, or whatever is still not learning to program. Learning to program effectively should be the first priority. All the OOP features in PHP5 are of no use to someone without good knowledge of OOP. Likewise, I'd gather that most of the insecurities in PHP are the result of poor design. PHP is great for its templating features, the ability to separate content from design, and its speed of development. But, that still doesn't make it secure or effective. How many times does a programmer get in trouble becasue they don't escape double quotes in a TEXT field in mysql, or account for malformed URL's, html, bad javascript, etc.?

    No matter how good these books are, and I'm sure they do a good job of presenting all of PHP's features and strenghts, they still usually lack teaching how to design a web site/application, how to effectively use passwords, secure data queries, efficient programming, etc. That might be an altogether different beast, but there's a world of difference between using PHP in a web site and writing a good web app. I'd wish that the books would focus more on good programming techniques. I don't imagine everyone will buy the book otherwise, and not everyone will benefit the same, but I've not found too many books that put "programming" ahead of "programming in".

    --
    My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    1. Re:persistent problem by JonToycrafter · · Score: 1

      Do you (or anyone) have any suggestions for a book that teaches beginning concepts, as you say?

      This isn't idle for me - I want to contribute to a particular open source project (via programming; I currently do testing/documentation/etc.). While I work in IT, my background isn't in IT, and my programming education stopped at CS102, many years ago. I've taught myself plenty of BAD programming in PHP etc., but I'd like someone to suggest a book that teaches "good programming".

      To put it best, I learned my programming habits in C64 Basic 22 years ago...I need some help.

    2. Re:persistent problem by Jerf · · Score: 1

      PHP is great for its templating features, the ability to separate content from design, and its speed of development.

      Um, sorry, could you show me which language more tightly couples content and design?

      Binding content and design is what those web template languages do. It's why they're better than traditional CGI scripts for quick projects and crash and burn for large projects, unless you add something to manage the separation. That some people have managed to assemble frameworks that do sort of separate content and design as things you can add-on, is more a tribute to the frameworks and the framework designers than PHP; the design of PHP really fights that sort of thing, since it "wants" to re-parse everything involved with the page on every load. (I am aware they have since "fixed" that problem; my point is that they had to fix it, not that it was unfixable. With other structures the problem doesn't arise.)

      (I'm sort of OK using such languages, but only when you can have backend code that isn't written in the template language. I use Perl and Apache::ASP, where the web app is backed by Perl modules that do all the heavy lifting and can actually be used outside of the webserver, too. The ASP/PHP-like code just does final formatting and display. The "design" is in the Perl modules and the "display" is in the ASP/PHP-like code.)

    3. Re:persistent problem by Anonymous Coward · · Score: 0

      You can't teach the reader to run before he knows how to crawl. If I want to learn the best practice's of a language, I'd prefer to buy a separate book.

      These are some of my favorite books on best practice's. They'd still apply to a language like PHP as long as you know a language like Java or C#:
      Code Complete
      Effective Java
      The Pragmatic Programmer

    4. Re:persistent problem by SpectreHiro · · Score: 1

      Do you (or anyone) have any suggestions for a book that teaches beginning concepts, as you say?

      I'm currently having some fun with the How to Think Like A Computer Scientist series - http://www.canonicalbooks.com/free-ebooks.shtml
      I'm reading the Python version right now, and it's pretty easy to follow.

      You might also want to take a look at MIT OpenCourseWare - http://ocw.mit.edu/index.html - I'm slowly working through their computer science courses. Emphasis on slowly.

      --
      You can't win, Darth. If you mod me down, I shall become more powerful than you could possibly imagine.
    5. Re:persistent problem by Anonymous Coward · · Score: 1, Interesting
      PHP is great for its templating features, the ability to separate content from design, and its speed of development.
      Excuse me?

      If anything, PHP actively promotes spaghetti code. It's PHP, HTML and SQL usually mixed together all over the place. How many times have you seen tr/td elements being output directly to the client from looping through the dataset returned by a query three lines above the table element? Because I've seen it a zillion times, and counting.

      There's only one "official" templating engine, and that's Smarty. However, in my experience, PHP folks tend to invent the wheel all over again, and call that "extensibility" and "the beauty of open source" (this despite their solution not having anything to do with actual open source). For example, where I work, the guy in charge invented his own little convoluted framework, the heart of which is a 300-line single recursive function (!) that does, uhm, things, and moves a significant part of business logic into his proprietary templating system. I swear, that's TheDailyWTF material, and I'm going to post it there as soon as I quit my job...

      The apps written in my company are full of bugs. The framework mentioned above doesn't allow any sensible SQL injection / XSS filtering. Different apps require different magic_quotes and register_globals settings (so we have a ton of different servers - management loves spending money on new machines). The code is unmaintainable. It takes roughly a week since someone reports the bug to actually find the code where it happens, because everything is contained in HTML frames which interact in an insecure fashion, there are dozens of code includes, a total of fifteen (!!!) CSS files are used, and I find myself constantly explaining basics to people around - like what the h1 HTML element is for, and why spacer gifs are bad. Everything runs extremely slow on dual Xeon machines, and it's a good day when 20 people can use one of the apps at the same time.

      And he has one of those "Learn uberl33+ PHP+MySQL" books on his desk. While you may argue "it's not the language/platform, it's the programmer", this certainly doesn't hold true with PHP. I have yet to see someone I could consider a good PHP developer - I'm sure they exist, but then again, so supposedly does Vista.

      Meanwhile, I've deployed a secure, documented, standardized 3-tier ASP.NET+MSDE app that serves roughly 300 people 24/7, and just for fun, I've deployed a RoR app on a free single-CPU machine that duplicates an existing PHP app and runs about 50 times faster.

      PHP is one of the worst things that ever happened to web development.
    6. Re:persistent problem by b17bmbr · · Score: 1

      perhaps it's in how you use php for templating. for example, after I design the layout using CSS2 (I never use tables anymore unless it's for data), I insert the applicable files: links.php, content.php, etc. You can do content and design separately in php, and in fact it works quite nicely. One just needs to use it well. That's all. it's the same in say java using a MVC design. In my AP comp sci class we wrote an address book (simple yes, but) we displayed the data singularly in a form (which could be navigated, edited, added, deleted, etc.), completely in a JList, printed out to html and displayed in a JTextPane, or even exported to .txt files. Four ways of viewing the same data. PHP can do the same, you just have to separate the two. I'm hardly a programmign guru, I just try to use good design practices, something which I admit took a long time to develop.

      bad code is cad code, and bad design is bad design. my original point was that php (or any other) books teach the specific language, not programming. I've no doubt that the poor code you had to maintain would have been poor in any language. 300 lines of a single funciton means the guy never learned how to code well.

      --
      My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    7. Re:persistent problem by r3m0t · · Score: 1
      Different apps require different magic_quotes and register_globals settings (so we have a ton of different servers - management loves spending money on new machines). The code is unmaintainable.

      Here's a tip for your .htaccess if you're using Apache:

      php_flag register_globals off
      php_flag magic_quotes_gpc off

      I would suggest you at least put together on the same server apps which have to communicate between each other. Then it's probably not worth the time.

    8. Re:persistent problem by Bloke+down+the+pub · · Score: 1
      Do you (or anyone) have any suggestions for a book that teaches beginning concepts, as you say?
      Code Complete, by Mike McConnell is pretty good, and it's not aimed at any particular language. I suggest you find it on Amazon (etc) and look around the lists that it proposes, the suggestions etc.
      --
      It's true I tell you, feller at work's next door neighbour read it in the paper.
  17. Only one chapter by LittleBigScript · · Score: 1

    Well, here is the problem. There is only one chapter on securing PHP and MySQL, and it is the 21st Chapter. Why put anything on the internet if there isn't sercurity on it.

    1. Re:Only one chapter by carlislematthew · · Score: 1

      One chapter is best. Security through obscurity! Hopefully noone will even find the chapter...

  18. WAMP kicks a considerable amount of ass by geekschmoe · · Score: 4, Informative

    WAMP (windows - apache - mysql - php) server is a cool thing I found if you want a quick and integrated solution to developing with mysql/php on windows systems. It puts a little icon in your dock that is similar to the start menu and you can start/stop all servers and enable/disable php modules, etc. It also comes with phpMyAdmin for managing the mysql databases. It's one big executable with installer and theres no admin stuff to deal with before you start programming. Not that any of the admin stuff is particularly difficult, just extremely annoying considering the frequency of changes to php and apache.

    http://www.en.wampserver.com/

    1. Re:WAMP kicks a considerable amount of ass by IflyRC · · Score: 1

      What you described sounds very similar to having an XP install with IIS, Visual Studio Express 2005 (VB or C#) and SQL 2005 Express. With that sequence I can be up and running, ready to go in less than 30 minutes.

    2. Re:WAMP kicks a considerable amount of ass by FyRE666 · · Score: 1

      Yes, but if more than a few people come to your site at once it won't look so rosy, eh ;-) Damned that pesky licensing with Single Vendor, proprietary software... WAMP allows you to run a proper website - although it's obviously preferable to host on Linux...

    3. Re:WAMP kicks a considerable amount of ass by IflyRC · · Score: 1

      I was speaking in terms of a development environment. Personally, I'd rather not run a website on a home PC with a non-server type OS installed.

    4. Re:WAMP kicks a considerable amount of ass by Ezku · · Score: 2, Informative

      There's another similar project by the name of XAMPP. XAMPP comes with quite a lot of other handy auxiliaries as well, such as eAccelerator, and it's available for Linux, Windows, Solaris and most recently OSX. The interesting thing is it supports both PHP 4 and 5, allowing easy testing of an application on both versions - and at least the Windows version comes with an automagical version switcher. I'd recommend giving both packages a look.

      Do note this, however (and I think it goes for WAMP too):

      The default configuration is not good from a security point of view and it's not secure enough for a production environment - please don't use XAMPP in such an environment.

    5. Re:WAMP kicks a considerable amount of ass by Anonymous Coward · · Score: 0

      From the movie, "Spies Like Us", General Sline says to Ruby and Keyes as they enter the secret underground facility, "Welcome to W.A.M.P."

    6. Re:WAMP kicks a considerable amount of ass by Turbs · · Score: 0

      What about XAMPP as opposed to WAMP? I use XAMPP and it's great, but I haven't used WAMP to compare. I assume it's pretty similar.

      Any thoughts or preferences from /. users?

    7. Re:WAMP kicks a considerable amount of ass by __aaclcg7560 · · Score: 1

      There's also MAMP for the Mac.

  19. Re:Any website? by Anonymous Coward · · Score: 0

    Keep in mind the target audience of the book. It is called 'Beginning PHP and MySQL 5' because it is for beginners. How many beginners are going to start out creating banking applications?
    If the developers at "all those banks and stock exchanges handling vast loads" are using PHP and MySQL with the help of this book to develop their applications, then I'm going to stuff my money under my mattress. Lighten up a little.

  20. What the hell is the title? by L-Train8 · · Score: 3, Informative

    My version of the book is titled Beginning PHP 5 and MySQL: From Novice to Professional. The title on the Barnes and Noble link says Beginning PHP and MySQL 5: From Novice to Professional, but the cover shown at that same link reads Beginning PHP 5 and MySQL 5: From Novice to Professional. So there is some confusion.

    --

    Don't forget that Friday is Hawaiian shirt day.
  21. Too noisy for me. by LMacG · · Score: 1

    "Spread over 860 pages and divided into a whooping 37 chapters" I'd prefer a book that does not whoop, especially over the course of 37 chapters.

    --
    Slightly disreputable, albeit gregarious
  22. Re:Any website? by Decaff · · Score: 1

    Keep in mind the target audience of the book. It is called 'Beginning PHP and MySQL 5' because it is for beginners. How many beginners are going to start out creating banking applications?
    If the developers at "all those banks and stock exchanges handling vast loads" are using PHP and MySQL with the help of this book to develop their applications, then I'm going to stuff my money under my mattress. Lighten up a little.


    The problem is that too many beginners are shown easy software development languages and techniques as if those are all they will ever need. This happened with Visual Basic in the 90s, and it is happening with PHP, MySQL and now Ruby on Rails. These are all great tools for development, but I have had personal experience of the disasters that can result when such tools are used beyond their capabilities.

  23. Whoop, there it is! by Anonymous Coward · · Score: 0

    As long as it's not "a pooping 37 chapters".

  24. MySQL by kanzels · · Score: 0

    I woudn't say that MySQL is for every website. Sure it is free, small and fast and will suit most webpages. But there are some heavy duty sites and those possibly need more power as in {insert name}...

    --
    Pixel image editor - http://www.kanzelsberger.com
  25. For me -- doing is better than reading by dada21 · · Score: 2, Interesting

    I've tried so many PHP and MySQL books over the years that I can't even keep track of what I'm reading. Coding just doesn't seem to make sense to me in book form.

    I learned the most I possibly could by downloading Wordpress (blog software), PHPBB (bulletin board software) and setting them up. I downloaded modifications and looked over the code in person.

    Over the past few months I've become really adept at writing my own PHP and MySQL-based software, to the point that I'm starting to design my own CMS interface. Not a single thing I've learned from a book has stuck, but everything I learn in chomping on code in Notepad or emacs seems to stick forever.

    Anyone else have problems with books on coding?

    1. Re:For me -- doing is better than reading by ToxicBanjo · · Score: 2, Insightful

      Me Too.

      I use books only as a language reference. I find that no matter what I'm trying to accomplish in code, any book I own doesn't have examples that "fit" the pieces of my app that I'm struggling with. So what good is a book with 1000 pages of example codes and 300 pages of theory when 95% of the time it doesn't fit what I need anyways? I prefer the reference style book or snippet archive (TurboPascal days): "a Listbox has these properties, methods, and events and here is how they work" or "To make an HTTP Request first declare a TCP/IP Object...". That is all I really need, short and concise.

      Beyond that it's just down to hacking. Working on sculpting code till it does what you want and how you want. I've learned more from doing than reading a million times over.

      Personally the only book I would recommend buying is one on writing tight secure code. Regardless of language as well, the fundamentals of truely professional code design are applicable to any programming language. Bounds checking, error trapping, raising errors, etc, etc, etc. I think we need more of that kind of book instead of new iterations of existing product that primarily rehash most of a previous version.

      --
      There are only 10 kinds of people in the world. Those that understand binary and those that don't.
    2. Re:For me -- doing is better than reading by Anonymous Coward · · Score: 0

      Yep right where you fail to realize what is good programming practice. You can learn all the hacking and cool stuff by just trying to do it. However when you have to write a big project that is modular, object oriented, easy to maintain and takes into account all the strengths and weakness of a programming language, you need to read a (good) book. IMHO.

    3. Re:For me -- doing is better than reading by Anonymous Coward · · Score: 0

      Books on scripting languages are just shitty replacements for free documentation on the Internet. You should be able to learn a programming language from its documentation and perhaps some tutorials. In languages like C++ where the semantics are incredibly complicated a copy of a standard and some books addressing complicated corner cases is helpful.

      More complicated issues in programming are not going to be learned from reading someone else's code; that simply shows the how not the why. In my experience people that learn primarily through random examples write awful software and have little understanding of the languages and databases that they work in. If all you're writing is a simple CMS (just what the world needs another of) it's not such a big deal. If other people have to deal with the code then it's a big deal.

  26. Re:Sec-exps already know PHP is the beginner's cho by KermodeBear · · Score: 2, Insightful

    Which is very unfortunate. It's possible to write good, secure PHP code. Others have too. PHP is marketed as an easy to learn language (and it is), and it is commonly installed on hosting services, so new programmers flock to it. The problem is that these new programmers are, well, new. They aren't aware of things like SQL injection attacks. They don't bother to validate data. They make new programmer mistakes.

    Is it the fault of the language? I can point to a few things where I can say, Shame on You, PHP!, such as the entire magic quotes 'feature' (which, iirc, is turned off by default now). But, as usual, it is the user, not the tool, that is at fault. This makes the language look bad because vulnerabilities pop up in software packages written in the language.

    It's easy to spread FUD when that happens, especially to management and other uneducated people.

    Some people say that the language should prevent programmers from doing stupid things. I disagree; I think the language should allow you to do what you want within the confines of its purpose, and if you happen to be making mistakes (such as not escaping data that goes into your queries) then shame on you. I don't see people complaining about C because it lets you point into kernel space and write garbage. If that happens, C programmers will point and laugh and say, "Ha ha, you silly newbie programmer!" not "Ha ha, C is retarded!"

    I don't see why PHP should be any different. Sure, there are things that could be improved, but overall, most of the vulnerabilities I see are not the fault of the language. It's just the web's version of the VisualBasic syndrome (OMG I CN PRINT TXT 2 SCREEN, I R GOOD PROGMMR!!!!11one!).

    The more used a language is, the more software that exists, and the more bugs that will exist - especially if it's an 'easy' language to learn.

    --
    Love sees no species.
  27. Sorry -- But no! by mlwmohawk · · Score: 0, Flamebait

    Sorry for the flaim bait, but I can't read something like this without correcting certain errors!

    MySQL is a very poor choice for high volume web sites that have a fair number of updates/inserts/deletes as, unless you are using InnoDB, you will be locking the tables and killing performance. If you are going to use InnoDB, you may as well use PostgreSQL for better performance.

    I'm sure we've all seen grocklaw crash once or twice because of MySQL.

  28. Re:Sec-exps already know PHP is the beginner's cho by xxxJonBoyxxx · · Score: 1
    I don't see people complaining about C because it lets you point into kernel space and write garbage. If that happens, C programmers will point and laugh and say, "Ha ha, you silly newbie programmer!" not "Ha ha, C is retarded!"

    This very issue would appear to be at the heart of many existing C (or C++) vs. Java arguments. The claim is/was that newbie programmers are not as dangerous if given Java.

  29. Already found a good one... by oahazmatt · · Score: 1

    I learn more by doing and then discovering the effects of what I had done. (Hmmm... fire does that... okay.)

    Seriously though, as a relative n00b in the PHP world, I like the visual quickstart guides by Peachpit Press for PHP and Advanced PHP, where there is a practical example of what you might need to use PHP for, in addiion to a disection of the code being used. Both of these books deal with MySQL as well.

    While I wasn't exactly scripting my own Nuke system in ten minutes, after some casual reading I was developing some rather unique portal systems that no one else had made available.

    --
    Those who believe the Internet is private,
    find their privates are on the Internet.
    1. Re:Already found a good one... by EugeneK · · Score: 0
      I learn more by doing and then discovering the effects of what I had done. (Hmmm... fire does that... okay.)


      Sorry, but I gotta quote good ol' Ben when you say that..;)

      Experience keeps a dear School, but Fools will learn in no other"
  30. Save $16.65! by Anonymous Coward · · Score: 0

    Save yourself $16.65 by buying the book here: Beginning PHP and MySQL 5.0. And if you use the "secret" A9.com discount, you can save an extra 1.57%!

  31. power and flexibility, gee wiz by nuzak · · Score: 1

    > The beauty of PHP is in its open nature and the rich set of libraries and modules which imparts a lot of power and flexibility to the programmer.

    The same could be said for python or perl. I think PHP's main "beauty" feature is how easy it is to install, nothing more.

    --
    Done with slashdot, done with nerds, getting a life.
    1. Re:power and flexibility, gee wiz by dave420 · · Score: 1
      The real beauty is its syntax and lack of explicit type definitions. That change is very logical, and removes a lot of the legwork required to develop (which isn't a bad thing).

      Also, as it's just as easy to install Perl, your argument doesn't hold a lot of water... there must be another reason it's so popular ;)

    2. Re:power and flexibility, gee wiz by nuzak · · Score: 1

      > Also, as it's just as easy to install Perl, your argument doesn't hold a lot of water

      Not mod_perl, it isn't. Well, at least not as easy to just drop in. It's easier these days, but I really think it held mod_perl back years ago.

      As for lack of explicit type definitions ... that of course is nothing that Perl/Python/Ruby doesn't have either. Its syntax I could take or leave ... it seems a bit nicer than Perl in some places (there's only one sigil), but nastier in others (no regex literals or operators) and identically lousy in others (still uses the -> operator where a dot would do). I think most PHP users feel the same way about the syntax... perl-lite, and nothing to scream about. (Hey, perlite, that would make a cute name for a language).

      As for me, I'm about evenly split between Perl, Python, and Ruby, but I really like fun little languages like Lua and Io, even if they're usually impractical for what I need.

      --
      Done with slashdot, done with nerds, getting a life.
  32. What can you do with PHP and MySQL ? by unity100 · · Score: 2, Funny

    During the years i have been using these, i have come to believe that you can to almost anything with these, except housework.

  33. Oh my God! by Anonymous Coward · · Score: 0
    WAMP (windows - apache - mysql - php) server is a cool thing I found if you want a quick and integrated solution to developing with mysql/php on windows systems.

    You were actually mod'ed "Informative" for somethign that, well, praises "Windows"! Fuck! I bet Hell, right now, is freezing over! I better check to make sure that my dog isn't sleeping with my cat!

    "Fido! Get off of Sylvester!"

    Jesus MF Christ! It's happened!

  34. How to put postgreSQL in LAMP by sago007 · · Score: 1
    if we could just replace the M in LAMP with PostreSQL
    I read this once at some Ubuntu message board (my screen saver):

    LAMP: Linux, Apache, Most of our cool scripting languages start with a P and PostgreSQL
  35. Stats, please by Pinball+Wizard · · Score: 1

    Where are the statistics to back up your assertion - that Postgres performs better with a high volume of inserts/updates/deletes than MySQL with InnoDB?

    Or are you just repeating something you've heard?

    Postgres may have more features and better support of SQL standards like transactions, triggers, stored procedures, etc, but these are things that improve data integrity, not performance.

    MySQL has always been oriented to performance rather than features and its use as a backend for web sites has always been a primary goal for its developers.

    --

    No, Thursday's out. How about never - is never good for you?

    1. Re:Stats, please by Decaff · · Score: 1

      Where are the statistics to back up your assertion - that Postgres performs better with a high volume of inserts/updates/deletes than MySQL with InnoDB?

      Or are you just repeating something you've heard?


      Why are you questioning this? This has been common knowledge for years. Both MySQL and PostgreSQL have their relative strengths.

      From Wikipedia:

      "Critics find MySQL's popularity surprising in the light of the existence of other open source database projects with comparable performance and in closer compliance to the SQL standards."

      MySQL has always been oriented to performance rather than features and its use as a backend for web sites has always been a primary goal for its developers.

      No. MySQL has always been oriented to performance for reasonably low volume applications and websites, and it does extremely well in this role, and is a great database for hosting websites. PostgreSQL, on the other hand, has always shown its strength for higher volumes of traffic and higher numbers of concurrent connections.

    2. Re:Stats, please by mlwmohawk · · Score: 1

      The problem with MySQL is that it isn't a good enough SQL dataase to actually run standard SQL benchmarks. I think, maybe, with 5.1 it may actually be able to run something like TPC, but I'm not sure. Arbitrary benchmarks are meaningless, how many inserts or queries a db can do is meaningless unless something is known about the data and the condidtions. If either the data or conditions of the test are bogus, then the benchmark is bogus. MySQL is very VERY good at crafting bogus benchmarks that make it look good.

  36. The beauty of PHP by Sweetshark · · Score: 0, Flamebait

    The beauty of PHP *head explodes*
    beauty? PHP? Have you every looked at it? closely? Do you know any other solution?
    Just look at the naming of is_null, empty and isset ...

    1. Re:The beauty of PHP by NullProg · · Score: 1

      Flamebait? Come on moderators, either you know the subject and can moderate or you don't and you shouldn't.

      PHP is the worse language found on the web. The only reason it exists is because its easy. Java/ruby/python make a much better solution than PHP on any platform.

      Enjoy,

      --
      It's just the normal noises in here.
  37. Re:Any website? by Decaff · · Score: 1

    To moderators. The original post was not intended as flamebait. It was a criticism of the very frequent attitude that all you ever need for any development are popular open source tools, and anyone resorting to Java or Oracle or DB2 is simply wasting their money. The flamebait is surely the original claim that MySQL is suitable for any website!

  38. Re:Sec-exps already know PHP is the beginner's cho by bturnip · · Score: 1

    C'mon, flamebait! From the link itself: "PHP is the most widely used scripting language for the web. According to some reports, 50% of the Apache servers world-wide have PHP installed." Do you think there is any chance that PHP is the most widely used scripting language might have anything to do with the number of vulnerabilities?

  39. Don't know the coding by Master_stghm · · Score: 1

    I use PHP, but I still don't know how to use it use it. The most I know is HTML, which doesn't really count, and Visual Basic. It would really help if I learned how to use PHP myself.

    1. Re:Don't know the coding by Anonymous Coward · · Score: 0

      Not to be an ass, but why would anyone want to know this?

  40. Re:Sec-exps already know PHP is the beginner's cho by masklinn · · Score: 5, Interesting

    Not blame the language? Why not? PHP is the only language that I know of that has like 6 or 7 functions just to escape strings to be injected in SQL queries and that still manages to get it wrong.

    I mean, first time you try to hit a DB, you've heard about SQL injection you want to escape your inputs, are you using addslashes? Nope, and you should stripslashes too, if magic_quotes are active, because even though they're built in they fucking fail. Oh, there's an sqlite_escape_string, but you're using mysql so you'd probably use this lil' mysql_escape_string... except that you were really supposed to use mysql_real_escape_string, cause it's the real one you know. And the best part of all that shit? there is not one of the unsafe function that's marked anything even remotely close to "deprecated" or "dangerous", they are unsafe and should never be used, that's old news, and you can still use them n/p

    Hell, PHP is the only language that I know of that does not feature any kind of prepared statement in it's standard DB interface. It only got prepared statements with the mysqli_ crapfest and that frigging piece of donkey poo requires you to create a prepared statement explicitely and then bind every single argument one by one to your statement.

    This thing is the most retarded standard DB interface that's ever been born in this world, and it's only taken like 4 years for the Zend retards to unleash this abortion on us! Developers rejoice, maybe in 4 more years we'll get a DB interface on par with Perl's DBI or Python's DBAPI2...

    And THIS is but one of the dozens of inherently stupid and/or insecure "features" PHP got built-in such as the good ol' REGISTER_GLOBALS, the hidden errors and notices, the lack of anything even remotely close to Perl's "use strict", the completely random and inconsistent function names and function outputs, the three-fucking-thousand functions all dumped into the global namespace (perl has 206, Python has 76 and ruby probably has less than a dozen)...

    I'm all for blaming the builder, as long as he's got usable tools. PHP is nothing that can be called "usable tool" with a straight face, the whole "language" is a gigantic hack built with feces and vomit, it IS to blame, and blame it I do.

    --
    "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
  41. Re:Sec-exps already know PHP is the beginner's cho by xxxJonBoyxxx · · Score: 1

    Yeah, that was my point. Lots of newbies are flocking to PHP, so lots of PHP apps contain newbie mistakes. In general, however, I'd say that PHP seems to be the exception to the "open source should be secure" rule. For example, PHPNuke continues to be wildly popular package even though most security folks will usually shut down and quarantine any server they find it on...

  42. This. Book. Suxxors. by Sembetu · · Score: 1

    Beware. I own this book, and I can tell you it is full of mistakes and inaccuracies. Nuff said.

    1. Re:This. Book. Suxxors. by Zaphod2016 · · Score: 1

      I have found errors in every programming book I've ever read. In fact, I REFUSE to buy anything until the author accepts this and puts up an "errata" website somewhere.

  43. Re:Any website? by kberg108 · · Score: 0

    I couldn't agree more. Some people think that a new set programming tools will make them produce better software. That's like thinking a new hammer will make you build a better house. If you don't have the design skills to being with your software will be a pile no matter what language it's written in or database you use. The sad thing is you see this behavior everywhere, where people/companies will abandon their current technology a spend all kinds of money and resources porting to a new technology that some programmer told them would solve all their problems only to find they have ported the design flaws with it.

    PHP, MySQL, Oracle, Java, etc are all just tools and in the hands of the correct developer can be used to produce incredible applications. In the hands of an amateur they will produce crap no matter the language.

    What I'd like to see is a decent book for beginners on how to design software and not one of these super abstracted pattern books that is so specific to the language that it complete pollutes the readers mind into believing the same concepts can't be used in a different language/databse/os.

    --
    I like things that are sweet and not things that are lame. --
  44. WAFP by mobby_6kl · · Score: 1

    Hey, Windows/Apache/Flat-file-db/Perl also works fine.
    At least for a site with ten hits a day. All of which are from 127.0.0.1.

  45. Re:WISP kicks more by cruachan · · Score: 1

    Windows, IIS, SQL Server and PHP. Only downside is SQL Server is expensive to deploy but it sure beats the pathetic excuse for a database that is MySQL.

  46. Plug for TinyButStrong by cruachan · · Score: 1

    Template systems have of course been around a while, but I must put in a plug for TinyButStrong - http://www.tinybutstrong.com/ - here. I've been writing PHP apps for some time but after casting around for a template system a couple of projects back dropped on this one. Absolutly brilliant piece of work and I've recently been combining it quite successfully with xajax - http://www.xajaxproject.org/

    I've no connection with either of these two projects, just a very impressed user (and the TinyButStrong promotional video is a wee gem :-)

  47. The one thing that keeps me from using PHP..... by Anonymous Coward · · Score: 0


    I know this is going to sound petty, but there's one thing that keeps me from using PHP for serious projects:

    $Those $damn $dollar $signs.

    I still don't understand why they can't add a "dollar sign optional" mode.

    Dollar signs are only necessary if you want to expand variables inside of strings. Since I don't do that, they are useless to me. They do nothing except cause a horrific amount of clutter in my code.

    There's no reason why they couldn't implement a "dollar sign optional" mode -- all they would need to do is fold the constant id and variable id namespaces together if that option was set.

  48. Oracle XE & PHP5 by Anonymous Coward · · Score: 0

    MySQL on a Windows box is slow as hell. If you've got enough hardware power (2GHz P4 or equiv and 1GB ram) then Oracle XE is a fast screaming monster. Oracle XE is free but does have a limit to 4GB total database size, but that's still quite a lot of database for small web apps. I recently built a fairly elaborate web app with Windows/IIS/OracleXE/PHP and it went together quite slick. I then ported the whole thing over to SuSE Linux 10.0 and Apache 2.2.2, PHP 5.1.4 and the OracleXE for Linux, and it runs literally four times faster on the very same piece of hardware.

    Here's an excellent site for Oracle/Apache/PHP info for both Linux and Windows platforms.

  49. php and mysql are popular b/c... by Anonymous Coward · · Score: 0

    php:

    1. php's procedural programming is relative easy concept to grasp.
    2. it is free.
    3. it can be a bear to set up, but they have gotten better and there are some packages that make it pretty easy.

    mysql:

    1. it got to the windows desktop first.
    2. it is good enough for many apps.
    3. it is easy to install with installers (windows) that install both php and mysql.
    4. it is a fast db, if not the fastest, under some circumstances.

    mysql is obviously a good tool - many people have used it successfully for various apps. the pudding is there to taste.

    having said that, i went with postgresql when i learned php. it took me a month to get a working version installed on windows. the docs weren't clear how to use the native db, so i was lost there. i did the cygwin thing... 30 days later, it was working.

    now i know how to install and use the native windows version.

    i value pgsql's features, not the least of which is the extraordinary license that allows a dev to use the db in commercial apps free of charge.

    there are other benefits, but that is HUGE for me. mysql definitely has some benefits in certain cases, too.

    investigate both and see which one works better.

    pgsql gets slammed by those who say it is slow. it isn't. in fact, on my internet app, it is extremely fast - and i use a db class and a forms class with my app.

    mysql w/o transactions might be faster in some cases, perhaps many cases, but once you set up mysql to run transactions (and probably a few other goodies, too), it slows down, too. it is a feature tradeoff. i value the features.

    any speed loss is often imperceptable.

    mysql is an able db in terms of speed. so is postrgesql.

  50. Re:Sec-exps already know PHP is the beginner's cho by wanna_be_a_developer · · Score: 1

    "Lots of newbies are flocking to PHP, so lots of PHP apps contain newbie mistakes."

    I might exchange newbie with ignorant. For example, a newbie is almost guaranteed to be ignorant, but someone who is not a newbie could possibly be ignorant and the mistakes are caused by not knowing any better.

    But, perhaps the biggest reason for poor apps is not newbies or ignorants, but rather is laziness. As you are aware, design, development and testing takes a lot longer than "getting something done".

    --
    Fo Shizzle!
  51. Wrong! by Pinball+Wizard · · Score: 1

    It is not common knowledge, and stats mean more than quoting a wikipedia article(which doesn't state postgres performs better, it states performance is "comparable"). My understanding of the "common knowledge" is that mysql offers better performance, postgres has better sql standard compliance and more features. Common knowledge would dictate that more features would slow down performance. For instance, extra data integrity checks every time inserts, updates or deletes are performed would be an extra feature, but it would come at the expense of speed.

    You are just propagating myths - how about real comparisons of performance, like these?

    http://monstera.man.poznan.pl/wiki/index.php/Mysql _vs_postgres (mysql tested faster)

    http://www-css.fnal.gov/dsg/external/freeware/pgsq l-vs-mysql.html (mysql tested faster)

    --

    No, Thursday's out. How about never - is never good for you?

    1. Re:Wrong! by Anonymous Coward · · Score: 0

      "Real comparisons", hehe.

      That site compares MySQL and PostgreSQL with the *default* settings. PostgreSQL kind of sucks with the default settings. Not sure about MySQL.

      It also does not test concurrency... and performs questionable queries which you would hardly ever run.

      DELETE FROM a; .. come on. How often do you delete without a WHERE clause?
      SELECT * FROM a; ...

      It's hard to compare databases, but this "comparison" really doesn't compare them at all.
      Well, it shows how the databases perform with their default settings, and how well it would work for a total n00b who has never in their life used a join, index, view, foreign key, or even a where clause.

      How about a test that actually stresses the databases and uses most of their features?

    2. Re:Wrong! by Pinball+Wizard · · Score: 1

      >> How about a test that actually stresses the databases and uses most of their features?

      Well, you've just restated my point. I'm not the one making the unverified claims about performance, I'm just asking for actual verification.

      --

      No, Thursday's out. How about never - is never good for you?

  52. "Libraries and modules" by Jeian · · Score: 1

    The beauty of PHP is in its open nature and the rich set of libraries and modules which imparts a lot of power and flexibility to the programmer. I haven't done a PHP install in awhile - is including these additional modules and libraries still as easy as recompiling the whole package, trying to get Apache to accept the recompiled module, then fixing all the scripts that suddenly don't work with the new module?

  53. Re:Sec-exps already know PHP is the beginner's cho by Zaphod2016 · · Score: 1

    As a php programmer, let me be the first to say: good point

    Anyone coding PHP without expanding into Perl or Python is giving themselves undue stress.

  54. Too much information by akuzi · · Score: 1

    860 pages about PHP and MySql? It seems like a lot, for what are very simple
    technologies.

    If you are an experienced programmer and want to learn PHP I would recommend
    reading O'Reilly's "PHP in Nutshell" book. You can read through the whole thing
    in less than a day and pick up most of what you will need to know. Also you
    cannot beat the online docs as a reference.

  55. Re:Sec-exps already know PHP is the beginner's cho by carlislematthew · · Score: 1

    Even non-newbie programmers are less dangerous with a managed runtime environment. Only the best developers (oh yes, that's *all* of us here - of course) are good at programming in C/C++.

  56. A sorry situation by teknico · · Score: 1, Informative

    The fact that PHP and MySQL are the most deployed tools for web development is a rather sorry situation, given the deep shortcomings of both tools.

    See these articles about the many PHP warts:

    Experiences of Using PHP in Large Websites

    Why PHP sucks

    The PHP Ghetto

    You will be happier with a more mature and complete dynamic language like Python, or even (gasp ;-) ) Ruby.

    Similarly, see these other articles about the many MySQL warts:

    MySQL Hate

    MySQL Gotchas

    Compare the last one with the one for PostgreSQL:

    PostgreSQL Gotchas

    Finally, an in-depth comparison between MySQL and PostgreSQL on Slashdot itself:

    Comparing MySQL and PostgreSQL 2

    Finally, recall that both MySQL's transactional backends are now controlled by Oracle:

    Oracle Acquires Sleepycat

    Avoid both PHP and MySQL as much as you can, I say. There's better stuff out there.

  57. Missing the point by ashley_moran · · Score: 1

    Postgres may have more features and better support of SQL standards like transactions, triggers, stored procedures, etc, but these are things that improve data integrity, not performance.

    Data integrity is ABSOLUTELY CRITICAL. Without data integrity your data is next to worthless! Even if your data is disposable, like a blog, inconsistent data can cause applications to fail. If it's not disposable, like financial data of some sort, data integrity should be your number one concern.

    MySQL would have to be an order of magnitude faster than Postgres for me to even consider using it as a backend for an application (which it isn't, of course). Even the recently implemented integrity features are flawed. Maybe with 5.1 MySQL will ressemble a useable database server.

    1. Re:Missing the point by Bloke+down+the+pub · · Score: 1
      Data integrity is ABSOLUTELY CRITICAL.
      But where it's enforced is totally optional. Last time I looked at a large, complex system there were other components there, not just the DBMS.
      --
      It's true I tell you, feller at work's next door neighbour read it in the paper.
  58. First sentence needs fixing by cunts · · Score: 1

    "PHP and MySQL use is so prevalent that nowadays it is hard to miss seeing a book review on the front page of Slashdot concerning these technologies."

    There, that's better.

    --
    "Laziness is nothing more than the habit of resting before you get tired" ~Jules Renard
  59. Moo by Chacham · · Score: 1

    Oh my, when you people get it? MySQL is NOT a database.

    It doesn't look like a database, it doesn't smell like a database. It's doesn't even taste like a database. And only the really nascent to the db scene would say it looks like a database.

    It happens to have an language interface that on some level partially coincicdes with what many people think SQL should be. But, that's where it starts, and that's where it ends.

    I'm not saying MySQL is a bad product. It's a wonderful product for quick web development and easy access to data, but calling it a database is like Win9x user saying they had a BSoD.

    1. Re:Moo by tehcyder · · Score: 1
      calling it a database is like Win9x user saying they had a BSoD
      Wow, I've never come across snobbishness over levels of BSoD-ness before.
      --
      To have a right to do a thing is not at all the same as to be right in doing it
  60. I think I'd rather learn by brooke_nobody · · Score: 1

    Ruby on Rails... It's so much easier to learn than PHP and it will likely gain dominance over its competitors within the next couple years. I hope that to be the case anyway, and I hope it gets the support it deserves. The drawback is that you probably won't find many businesses out there that will employ you based on ruby/rails knowledge yet. That's where PHP/ASP will win, but you can always freelance!

  61. Or what about? by gregarican · · Score: 1
    Seaside? This is more obscure than RoR but just as powerful and effective. It doesn't have all of the autoconfiguration and templating bells and whistles but can adopt something called scriptaculous for total AJAX style goodness.

    I have used RoR and am impressed with what it has to offer. Check back in a year and it might mature to the level for larger scale projects that aren't as vanilla boilerplate as is the case now. I have used Smalltalk as an OO language and am starting to teach myself Seaside since it looks to be a good fit for certain potential freelance work.

  62. You don't really need to buy a book for this by dilute · · Score: 1

    Basically, this (below), plus a litte SQL, and 15 minutes of installation is all you really need to know/do to get very well started - you don't need a book --

    <?php
    $connection = mysql_connect($location,$user,$pass) or die("Couldn't connect to DB server.");
    success_code = @mysql_select_db($db, $connection) or die("Couldn't select database.");
    $sql = "SELECT * FROM $table";
    $result_set = mysql_query( $sql );
    while ($row = mysql_fetch_array( $result_set )) {
        do_something_with( $row );
    }
    ?>

    The only even slightly tricky part is initially setting up permissions on MySQL and creating a database.  The MySQL and PHP online manuals will show you that and everything else you need to know.  Also, the package phpmyadmin automates a lot of MySQL administration tasks (from a Web-based client), so you don't initially have to learn a lot of command line stuff.

    Ubuntu has all of this packaged and readily installable from Synaptic (as does Debian for that matter).  Just click and install apache2, php5, php5-mysql, mysql-server, mysql-client and phpmyadmin and you should be ready to go.

    Really though, after you get the basic concept, you should try Ruby on Rails.

  63. Re:Sec-exps already know PHP is the beginner's cho by Anonymous Coward · · Score: 0

    Clearly you have no idea what you are talking about.

    I have produced many a php app that connect to a MySQL database securely without using any weird and unnecessary strip_slashes fucntions and the like. I have no idea why such functions are even there, for lazy programmers who do not know how to design well?

    Get a fucking clue asshole.

    Typical crap on php stuff here at slashdot, I guess the perl fanboys will never tire of shitting on php. If I wanted to load my server cpu beyond belief I'd use perl, till then php is far superior scripting language. In my assesment perl is for rich folks who need an excuse for having ridiculous processing power on a server.

    Now everybody bow to our perl overlords. Clearly they are craving the attention.

    Oh, and on the subject of the review: RTFMS - they are complete and free!

  64. Re:Sec-exps already know PHP is the beginner's cho by dicarve · · Score: 1

    Wow!!! Do you already read all that PHP manual? I suggest you yo try to make a better web scripting language than PHP. If you can't do that, then try to analyzed and change those PHP C Code, find any bugs (thats the beauty of open source!!) and then released it to Open Source community and then lets see what bugs do you have!

  65. Re:Sec-exps already know PHP is the beginner's cho by houseofzeus · · Score: 1

    As someone who works in PHP almost every day, thankyou, I couldn't possibly have put it any better myself.

  66. Re:Sec-exps already know PHP is the beginner's cho by Senzei · · Score: 1
    I suggest you yo try to make a better web scripting language than PHP.

    No need to, it has been done. See python(turbogears, django, web.py, twisted nevow, probably about 10-20 others I have forgotten) or ruby(on rails, plus a few others) or perl(plus a lot of stuff I don't know) or a host of other, not stupid languages for details. Except they are not "web scripting languages" they are scripting languages with web platforms, which makes life really really easy when your website needs to talk to anything aside from a database and a web browser.

    If you can't do that, then try to analyzed and change those PHP C Code, find any bugs (thats the beauty of open source!!) and then released it to Open Source community and then lets see what bugs do you have!

    Why should I polish someone else's turd? I could spend all of that time expanding a sane platform instead of trying to fix the stupidity of php. For another argument against this idea, try to submit a patch to zend and see how long it takes to go through. Do the same for one of the frameworks in another language and tell me who is really interested in the OSS philosophy.

    --
    Slashdot: Where anecdotes and generalizations can be freely substituted for facts, logic, or intelligence
  67. Re:Sec-exps already know PHP is the beginner's cho by dicarve · · Score: 1

    What do you know about OSS philosophy!? Blaming other OSS application is not ONE OF OSS PHILOSOPHY!! From my point of view there is no "Better than this" in OSS world, you learn how to respect others people creation. If you make an OSS application i'm surely will respect that! comparing OSS app to another OSS app is a fool!! Do you know meaning of DESIGN? Design of application : - PHP is DESIGNED to build dynamic web pages quickly - Perl DESIGNED mainly for text-proccessing and system administration - Python DESIGNED for prototyping and application extension OSS is about community! you blame the OSS app and you also blame the Community behind it... Let me know WHAT your OSS philosophy...

  68. Re:Sec-exps already know PHP is the beginner's cho by Senzei · · Score: 1
    What do you know about OSS philosophy!?

    Here is what I know of OSS philosophy: Write cool software, share it with the world, let people help you make it better. In a nutshell that is it. The OSS philosophy comment was directed at Zend taking patches to fix some of the glaring problems with php as a development platform, or rather the fact that they are pretty difficult about it.

    As for your comments about what a language is designed for, that is just foolish stereotyping. Python comes pretty close to Perl in text processing for most cases, Perl can do pretty well for rapid prototyping as well. As far as I know (python personally, perl by reference) they are both good for dynamic web pages. In short: both languages are good at a lot of things. PHP is supposedly only good at dynamic web pages, and stupid crap like string escaping make it difficult for that. If you really believe I am wrong here spend enough time with another language or two to really get to know it, build something you would want to be paid for in it, then come back and tell me php is better.

    --
    Slashdot: Where anecdotes and generalizations can be freely substituted for facts, logic, or intelligence
  69. Re:Sec-exps already know PHP is the beginner's cho by dicarve · · Score: 1
    Here is what I know of OSS philosophy: Write cool software, share it with the world, let people help you make it better.

    If you can blame PHP for its handicap, then make it BETTER!! thats what i mean!! don't just blame it.

    If you really believe I am wrong here spend enough time with another language or two to really get to know it, build something you would want to be paid for in it, then come back and tell me php is better.

    I also learn and use Perl, but mainly for shell scripting purpose and parsing text files. But then PHP came out and its easy yet its inherited some Perl features. I also learn Java, but i used it to write some desktop application and many people said it best for mobile device application.

    Do you only know about string escaping function in PHP?? and what stupid about it? tell me one by one, what stupid about mysql_escape_string, addslahes etc. Have you ever read PHP Manual yet?? Do you know that PHP support PCRE same like Perl did for parsing text (i used it in both Perl and PHP).

    Nothings perfect in this world, me, you or other peoples in open source community can make it near perfect!

  70. Re:Sec-exps already know PHP is the beginner's cho by houseofzeus · · Score: 1

    Why work to make PHP better when he can help improve another scripting language that is already starting from a better base?

    What's stupid about the string escaping functions is something you allude to your self (and the OP did as well), there are to many of them, many of which do either:

    A) The same thing as each other.

    OR

    B) The wrong thing, and are hence deprecated (and should never have been introduced in the first place).

  71. Re:Sec-exps already know PHP is the beginner's cho by gbjbaanb · · Score: 1

    And perhaps that's a bad thing. After all, if I had the system cleaning up after me, preventing errors (no matter how it affected the performance, etc), then I wouldn't be as good as I am today. After the 10th time my app crashed because I didn't quite know what I was doing with memory or pointers, I got it figured out. So maybe this is a case of 'all of us here' actually being somewhat true - we had to do it the hard way, we learned, we became better programmers for it.

    Besides, the Java programmers are just jealous they're not as good as us :-)