Skip to main content

What should every PHP programmer know?



I would like to be a PHP/MySQL programmer





What are the technologies that I must know?





Like:





  1. Frameworks



  2. IDEs



  3. Template Engines



  4. Ajax and CSS Frameworks







Please tell me the minimum requirements that I must know, and tell me your favourite things in the previous list?





Thanks


Comments

  1. First off, there is no must know about learning PHP and MySQL... You go into it not knowing anything, and you'll come out of it knowing a bunch. If there was a must know, then nobody would be able to get into PHP and MySQL development. I personally think you are at a slight advantage going into this without knowing everything about it. It'll give you a fresh perspective and a think outside of the box attitude :)

    As far as the object oriented stuff in this thread, it's true. But, as others have said, it's completely up to the programmer (you) to decide how to write your code. You can use object oriented practices, make a spaghetti code junction, or just right a bunch of functions, or whatever. Either way, as everyone else has been saying, it's up to you :)

    IRC channel:

    Don't really need this, but I find it helpful... See you in here :)

    irc.freenode.net #php

    Manual:

    The manual is your friend and probably the only thing you should know before diving in.

    http://www.php.net/manual/en/

    http://dev.mysql.com/doc/refman/5.0/en/apis-php.html

    Frameworks:

    Make sure it's an MVC framework :)

    http://www.cakephp.org/

    http://www.phpmvc.net/

    http://www.codeigniter.com/

    IDE:

    Whatever suits you best :)

    http://www.eclipse.org/

    http://www.vim.org/

    http://www.zend.com/en/products/studio/

    http://php.netbeans.org/

    Template engines:

    PHP is a good template engine

    Model view controller frameworks help with this

    Ajax:

    http://jquery.com/

    http://www.mootools.net/

    http://developer.yahoo.com/yui/

    http://www.prototypejs.org/

    http://www.extjs.com/

    http://code.google.com/webtoolkit/

    CSS:

    http://www.yaml.de/en/home.html

    http://code.google.com/p/blueprintcss/

    http://developer.yahoo.com/yui/reset/

    Definitely not an exhaustive list, and things change constantly... But, it's a start :)

    Have fun!

    Chrelad

    ReplyDelete
  2. Security is an important topic every web programmer should study before being allowed to post code that can be accessed publicly on the internet.

    Examples of security issues:


    Injection flaws
    Cross-site scripting flaws
    Cross-site request forgery


    There are more security issues that you should know and keep in mind as you write PHP applications. The website http://www.owasp.org contains lots of useful information to help.

    ReplyDelete
  3. What should every PHP programmer know ?


    You need to know a language that is not PHP. I'm not saying you shouldn't develop your sites in PHP, it's actually really good for that, but you really need to know at least one other language to get some perspective.

    Why? PHP is broken and full of bad design and misfeatures. You can write excellent code in PHP, but you're never going to be able to spot the bad design and failures of PHP itself if you don't know any better.

    I'd suggest python, ruby, or C#

    PS: If you don't think this is a helpful suggestion, then by all means downmod this answer, but if you are downmodding because you feel insulted by my claim that PHP is broken and badly designed, don't shoot the messenger, I'm just telling the truth!

    ReplyDelete
  4. PHP was my first language, which I learned on the side while working as an office junior in my first job over 10 years ago. Here is some things from my experience:


    Download the PHP manual, print it off, and start reading from page one. Keep going till you're at the end. Skim over the bits you probably won't need (like using KADM5 or Hyperwave) but always read the introductions so you know what PHP is capable of (this will save you trying to re-invent the wheel). The PHP documentation blows the docs of pretty-much every other language I've worked with since out of the water.
    Next step; set up PHP. Manually. Don't use XAMPP or anything else, do it yourself. It always helps to know how your environment is set up.
    Don't bother with an IDE at the beginning. Getting to know a language means getting up-close-and-personal. IDEs obscure things in an attempt to help you GetThingsDone which works great when you know what you're doing and know your target environment, but when you're starting out they just get in the way and hide what's important.
    Don't bother with frameworks at the beginning, either. Again, they're there to help you GetThingsDone which only works when you know what you're doing in the first place. Start with the basics, otherwise you'll be learning the framework and not PHP.
    PHP is essentially an advanced templating engine. Don't fall into the trap of over-hyped "PHP templating engines". They're just doing what PHP already does, doubling-up on the work and running twice as slow as PHP does. Stick with inline html/php to start with. Again, this'll help you get to understand what PHP is, how it works, and when to use it.
    As with AJAX and CSS... they're nothing to do with PHP, but with the output you produce from PHP (and with AJAX getting input in). Don't load your plate with too much to eat at once. Start with plain PHP+HTML, and do your CSS by hand. Then, when you're happy, mix in a little javascript.
    The best thing you can do with any language is learn the environment you're going to be working in, because programming is (relatively) similar across all of them. They all have loops, data structures, input/output, etc, but they all work just that little differently.
    Don't believe the hype. I'm moving from PHP to Python at the moment and I could've just jumped on the Django band-wagon to GetThingsDone, but I know that if I came across a problem I wouldn't know where to begin to fix it. So I'm taking my own advice and starting from the beginning; reading the manual, setting up an test system, parsing simple files, getting input/output, getting it linked in with a web server... all part of getting to know my new environment.

    ReplyDelete
  5. First of all, that PHP itself IS a templating system

    ReplyDelete
  6. Security.

    Just like Lucas Oman said - it is up to you in PHP to write the code well; and it does not coddle you. If you don't understand why you need to confirm a logout, or why you can't just validate in javascript, or why register_globals is bad - your app will be vulnerable in some form or another.

    ReplyDelete
  7. You need to learn the following (I would suggest in this order):


    Basic Object-Oriented Principles (such as inheritance, polymorphism, and encapsulation)
    The PHP language itself. Specifically, PHP 5.
    Database Design Principles such as tables, keys, relationships, normalization, etc.
    SQL - Structured (or Standard never can remember which) Query Language. Specifically learn the basics of select, insert, update, and delete queries.
    Good design principles and coding practices (you can find posts here on StackOverflow for one) such as dividing presentation and business logic.
    A Framework, Any Framework - this will help you become introduced to more advanced concepts of object-oriented design patterns and allow you to follow tutorials that will encourage good design and coding practices.
    Object-Oriented Design Patterns like MVC, Database Abstraction Models and the like
    Advanced SQL and other database stuff like triggers, stored procedures, and other functions.

    ReplyDelete
  8. All good answers, but there is something important missing: If you want to seriously get into PHP, then you should be aware that there are a lot of PHP programmers out there who are lazy, inept, ignorant, misguided and unfortunately get their code released to the public. The history of PHP means that it supports some questionable features (not just things like register_globals but also smaller things like automatic initialization) and people still use them. You don't want to.

    ReplyDelete
  9. I would say the most important thing is to learn how the whole process of building a page with PHP works - in that requests come from a client (web browser), hit the web server, get passed through to PHP, which then generates the response that is sent back. A solid understanding of this will ground you in


    why you can't send headers after output has started
    how sessions and cookies work
    how each page should be built in a stateless manner (i.e. deliver whatever the request asks for, don't remember what happened last time, or guess what the user is doing)
    The difference between HTML, PHP, JavaScript and CSS, and more importantly, what each is used for primarily and where the responsibility of each lies.


    Once you've got that down, then you should be quite comfortable with writing any app. But unless you've got that down, you'll start mixing things as I've seen many rookies do before now.

    ReplyDelete
  10. That every value everywhere has to be encoded appropriately. echo $some_variable_that_seems_innocent is evil nine times out of ten.

    Use htmlspecialchars() in HTML/XML, prepared statements or at least addslashes() when building SQL queries, json_encode() when inserting values into scripts, rawurlencode() when appending URL components, escapeshellargs() when constructing shell commands, etc.

    If you insert text in URL that's part of a script in XHTML document, you'll need to encode data three times.

    ReplyDelete
  11. Ignore the mysql_* functions. Not only do they provide no straightforward method of writing secure code, they actually go out of their way to make it painful and tedious if you try. Use mysqli or PDO instead (and you've got no excuse now - PHP 4 was end-of-life'd months ago).

    ReplyDelete
  12. Use a great IDE (like Eclipse for example) that let you debug and have some code completion. This will save you some time.

    PHP have a lot of programmer and is very popular = a lot of thing is already done for you, before writing some code, doing a google search is always a good idea.

    You should use some of the Framework if you start from scratch. This will answer all your question about AJax, template engines... because most of them come with these packages.
    Here is some post about how to start choosing a framework: SO 1, SO2, Here is a list of PHP Framework.

    You can develop PHP on Windows, Linux or Mac.

    ReplyDelete
  13. Although this isn't a technology, I think it's very important that you understand that, when using PHP, it is completely on you to write good code. PHP is capable of it, but it does not encourage it. You are completely responsible for writing code that is well designed and, if you choose, follows OO principles. You will have no help from the language.

    ReplyDelete
  14. Getting a web server setup

    To run PHP and MySQL locally on your computer you will need to install Apache webserver with php module and MySQL database server. ie. a LAMP webserver (Linux Apache MySQL PHP).

    In the past, I would recommend installing Ubuntu. These days, there are a few solutions available that will give you one click installation webserver without using linux.

    For Windows:
    http://www.wampserver.com

    For OSX:
    http://www.mamp.info

    After having a LAMP webserver use w3schools.com tutorials to start.

    ReplyDelete
  15. You should know how to use effectively at least one Debugger/IDE. It is amazing what you can learn from your code by stepping through it and watching it run. It both makes it much simpler to track down bugs, and improves the quality of your code. I believe you should never commit code to a project that you haven't seen execute.

    ReplyDelete
  16. The PHP Language

    Go to PHP.net and read through all of the documentation. When you are done, you won't know everything you need to know about php, but you will know where to look.

    ReplyDelete
  17. I would say a basic one would be HTML. ;)

    ReplyDelete
  18. Be careful of code snippets you find on the web. Often they contain sql in html, which is bad practice, as well as security vulnerabilities such as sql injection. I've seen few that use prepared statements, which is good for security.

    ReplyDelete
  19. No Php framework expert.As templating which make the system much complex then as it.
    Understand business logic requirement and think the cons/pro.Hoping for SA to think all for you is not good programmer.
    No ajax.I dealing with large of data,rendering to one js file about 4000 k data is very bad.
    Start from notepad or VI
    After learn php about 1 to 2 years,try learn other language like c# or c++ to improve your php application.
    Php is addicted language rather then other language.You type it works.Other language,you type It's Compile It's Hang up.
    7.For complexity application,php is the best to me rather then other language,because you think,you write it works.

    ReplyDelete
  20. Personally, I found the book "Build your own database driven website using PHP and MySQL" extremely helpful.

    Other than that, the one thing I found hardest to get used to with PHP is how relaxed it is, compared with any other language I've ever used. By that I mean no types, flexibility about syntax and punctuation. Personally I think that's a good thing, but I also know that it probably encourages pretty bad behavior.

    Here's one other tip I have: try to use something like the DRY principle -- i.e., you'll find yourself writing the same little (or big) bits of code over and over again -- make them into functions as early as you can in the process of coding, and life will be a lot easier later on.

    ReplyDelete
  21. Beside the points that were already mentioned: You should learn how the HTTP works and that you cannot trust the user.

    ReplyDelete
  22. Tools.... I've discovered a number of tools that improve code quality, streamline rollouts, and generally make life as a PHP developer a whole lot easier.

    ReplyDelete
  23. originally it was a script for perl

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex