Please help me learn PHP

Discussion in 'Mac Programming' started by jc0481, Dec 23, 2008.

  1. jc0481 macrumors regular

    Joined:
    Mar 16, 2005
    #1
    My old co-worker helps people on the side with their computer problems. He first started out with family and friends and now those people thru word of mouth told other people. I was talking to him during our lunches. He told me if you can learn both HTML and PHP really well you can enjoy what you do and make money from it. He has told me he has done some small businesses websites in PHP. He has also made some good money from that too.

    I would enjoy doing more programming because right now that's what I am going to school for. The money would be nice as a side job but would interest me more is getting the experience and most likely putting my name out there when I do graduate from school.

    What am asking is what would be the best way to learn HTML and PHP. I have not reached these courses yet in school. By the way the best way I learn is doing hands on work and visual comes in second.

    My family or at least one of them will be getting me a gift card to Barnes & Noble for Christmas this year. They usually do anyways. Will it be a good idea to get a couple of books in HTML and PHP to start from scratch? Or will I be better off learning thru some tutorial online and also being cheaper than buying a book? I asked one of friends who is a programmer for his work what is a good book for programming. He told me O'reilly books are very good and their books pertain to novices and experts in one book.

    I just wanted to let you know my primary computer is a macbook. I am thinking of getting Windows Vista to do a dual boot. My brother in law is in the Navy and can get a really good discount on the Windows operating system. If I can't do that I can also go thru newegg.com

    JC0481
     
  2. grimreaper1377 macrumors regular

    Joined:
    Oct 20, 2007
    #2
    a) You won't need Windows to use/learn php. Leopard already comes with PHP, Apache, and MySql is easy to install.
    - Installing mysql
    - Enabling php

    b) In terms of learning, PHP and MySql Web Developmeny by Luke Welling and Laura Thomson (ISBN 0672329166) is very complete, albeit HUGE.

    c) You'll need a good text editor. TextWrangler is the best free editor out there.
     
  3. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #3
    First yuo need to learn jst general programmming. This is the big step and you can do that with java or C or whatever. PHP is just a slightly difernt syntax ad you can pick it up quickly.

    The other thing is HTML and related web technologies. This you can learn without need to know anything about programming.

    You use HTML to design web pages. But designing web pages means more then just writing the code. The importent paet is the graphic design. So you really need to study Graphic Arts.

    You r question is a little bet like saying "I want to write a novel. How do I learn work processing?" Yes you would have to know how to type to get that novel written but more impotently you need to become a writer and have something to say.

    Texhnically here is the chain of events. Browsers accept HTML and render it to a page that yu can see. PHP is used to generate the HTML. So if yuo are creating web pages with PHP you are writing a program to output HTML and the HTML will generate a graphic design.

    Very few people can put this all together Photoshop, Photography Graphic arts and programming and networks. Most people become specialists and work with others. Well not really, most people just use software that hides all of this and presents a point and click interface to web design

    The best way to learn? Start with web design and HTML and worry about PHP later. After all you will not have much luck writing a progam to general HTML is you can't type HTML by hand. So learn that first.

    You can look at HTML right now. In your browser click "view source" and see the HTML for this page.
     
  4. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #4
    Hi

    If you want to become a web developer and head down the PHP route I would be tempted to learn HTML, CSS and JavaScript first and then PHP and mySql. It will take longer but I think in the long run it will be better.

    In practise you wouldn't learn everything in such a linear fashion but I would put the emphasis on html because it is the most important. To learn it properly you need to use a text editor and create sites by hand. In this way you'll learn the tags, what they do and how to use them. CSS is very important because all good web sites rely on it heavily nowadays and if you're serious about being a web designer/developer then being able to code a site to use CSS is an essential skill. If you throw JavaScript into the pot you will have a pretty good skill base to sell and develop further. As an example, if you know JavaScript, you will be able to add and customise Google maps to your sites - something you can't do in PHP. JavaScript will be a good introduction to general programming and so will not be wasted when you start learning PHP.

    b e n
     
  5. Zortrium macrumors 6502

    Joined:
    Jun 23, 2003
    #5
    Javascript is a weird language in a lot of ways, and definitely not one I'd recommend to a first-time programmer.
     
  6. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #6
    Sure, there are better languages to learn if you want to be a programmer... but if you want to be a web developer then it is pretty essential that you know it.

    b e n
     
  7. mikes63737 macrumors 65816

    Joined:
    Jul 26, 2005
    #7
    I would definitely learn HTML then CSS then PHP and/or JavaScript.

    You need to know HTML to really see what the other languages can do.

    I think you should do CSS next because that's what you (should) use to do page layouts. You should get a solid layout going before you start working on fancy stuff with JavaScript or PHP.

    Next, I would go to either JavaScript or PHP. JavaScript is used for things on the client side, like pop ups (there are some legit uses), visual effects, and more. JavaScript is a tricky language sometimes. It doesn't tell you if you've made a coding error, like forgetting a ';' or a '}'. It will just fail silently. Also, there's no guarantee that the client will have JavaScript enabled.

    Finally, PHP is a server side language that can be used to talk to a database, create dynamic HTML, process user input, and lots more. I think that PHP is a hell of a lot more useful and reliable than JavaScript because it's handled on the server. Whatever has to be done is done either on the server or sent to the client as HTML or headers.

    HTML is kind of like the glue that brings everything together.


    To get set up (if you're running Leopard) turn on personal web sharing in System Preferences (under Sharing) and then enable PHP by following this tutorial: http://foundationphp.com/tutorials/php_leopard.php

    Anything placed in the Sites folder in your Home directory will be available at http://localhost/~YourUserName (don't forget the ~)

    Books are good. I really like the '___ in a Nutshell' series. Online, for PHP, IMO the BEST reference by far is http://php.net - you can search by function and it will tell you what it's used for and how to use it. For everything else, use http://w3schools.com/

    For a text editor, I recommend Smultron from http://www.tuppis.com/smultron/

    And finally, there's no reason to install Vista on your Mac for web development except for testing. Also, you should pay for a legit license, even an OEM license from Newegg. As much as I dislike Microsoft and Windows, using someone else's discount to buy Vista is illegal.
     
  8. lazydog macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #8
    You can always turn debugging mode on in Safari. It's good for debugging CSS as well as JavaScript. It doesn't catch all JavaScript errors though. Firefox on the other hand is much better at reporting JavaScript errors.

    b e n
     
  9. savar macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #9
    This is a really great analogy. Programming is a unique engineering discipline, because unlike building bridges or buildings, you can create a program at very low marginal cost. If you screw up, the only thing wasted is your time.

    This, in turn, leads to a HUGE number of "developers" who are self-taught. This isn't a bad thing per se, but if you consider what construction would be like if 80% of the engineers were self-taught, you'd quickly realize what a disaster it would be.

    Yet, software engineers are entrusted with things equally as vital: money, privacy, and sometimes even lives.

    I don't say this to discourage you, but you need to realize that software engineering is a very large and complex undertaking. Once you begin to understand how to build small pieces of code, your education will have only just then have begun.

    I suggest that you do the following:
    1. Buy a PHP book -- any one with good reviews on amazon or barnes & noble
    2. Once you understand everything in the book, challenge yourself by coming up with an idea for a project and then building it.
    3. Once you've begun to learn to program, then your software engineering education begins. Buy the book "Code Complete" and read it cover to cover.
    4. Hang out on websites where they talk about coding... I like thedailywtf.com, but there are several good ones out there. You can learn a lot about what *not* to do on those forums.

    Most people just simply don't have the type of analytic skills it takes to program; out of those who do, an even smaller portion really understand how to engineer software. But if you're committed to this idea, I wish you the best of luck.
     
  10. keltoid macrumors newbie

    Joined:
    Jul 18, 2008
    #10
    Can you build a php program/project on an already established asp.net framework? Between php and asp.net, which would you say is the better server side application for retail web sites?

    Thank you
     

Share This Page