SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Thread: PHP [ Online ]

  1. #1
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP [ Online ]

    Hi,

    I've a bit interest in learning PHP. I know a lil HTML and I was wondering is it possible to learn PHP online from website? I know w3school and some other tutorials but they doesn't really help.

    Can someone help me?

    Thank you.
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The PHP website is a good start. Look at the tutorial and then the best way to learn is to simple play with it and look things up in the manual, which is very good.

  3. #3
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    The PHP website is a good start. Look at the tutorial and then the best way to learn is to simple play with it and look things up in the manual, which is very good.
    Can this make me a PHP expert? if I try hard. Is this how you guys learnt the language?
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....

  4. #4
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would seriously get like the php bible from the library.

  5. #5
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm not an expert, but that is how I have learnt. That, and simply searching for my problem on Google.

  6. #6
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, the tutorial seems to be really helpful but do I have to install php on my PC and some webservers? apache ? and stuff.

    explain , thanks.
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....

  7. #7
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It's helpful. You can get packages that contain PHP, Apache, MySQL and other things and make installing and using these things very easy. I use XAMPP, which I think is very good.

  8. #8
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To run locally you'll need web server software, PHP and realistically a database server too.
    Apache, PHP, MySQL is the most common setup.

    A package like XAMPP will be the easiest way to get setup.

    Apache serves your pages. PHP scripts are unlike HTML in that they need to be processed server side before the output is sent to the browser (client side). PHP is installed as a module into Apache. When you request a .php file PHP parses it, and Apache serves the output.
    The actual PHP code never goes to the browser, just the resultant output.

    I'd actually give the manual a miss at first. Find some Hello World tutorials to get started. Once you're familiar with creating very basic scripts learn how to read the manual to see how functions work.

    A book is probably a good idea too. The sitepoint Builid your own database driven.... is the only beginner PHP book I've read, it's worth having.

    Get started with PHP5, and try to avoid any tutorials that were written years ago. While I recommend starting with basic tutorials you need to be aware that many aren't all that great for best practice coding.

  9. #9
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK.

    How can I get those web servers installed on my PC? I'm pretty new to this. Where should I start programming?

    I used to do programming on notepad and save it as .html , is it the same with php?
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....

  10. #10
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easiest way is to install XAMMP as suggested. Then save .php scripts in the htdocs dir of the Apache install.
    To access the PHP script you'll need to browse to it through localhost. This gets Apache to serve it, and PHP will parse the file.

    If you script was called myscript.php then you'll open http://localhost/myscript.php in your browser.
    I recommend creating subfolders in the htdocs directory for different projects.

    You can use notepad, but I'd strongly suggest Crimson Editor or Notepad++ instead. They will make your code a lot easier to read, and will make mistakes much easier to spot.

    A very basic script will look something like this.
    PHP Code:
    <?php
    $message 
    'Hello World';
    echo 
    $message;
    ?>
    When you execute this in the browser look at the source code. You'll notice that none of the PHP comes through, you will only see the Hello World text.

    A slightly more advanced script that uses a function might look like this:
    PHP Code:
    <?php
    echo 'Today is ' date('l, j F Y');
    ?>
    See the date function. The string 'l, j F Y' is passed as a parameter to the function which outputs the current date in a certain way.

    You can also embed PHP in your HTML. The PHP tags determine what PHP will parse.
    Code HTML:
    <p>This is a normal HTML paragraph, but it can tell you that it's <?php echo date('F');?> this month!</p>
    <p><strong>Amazing!</strong></p>

  11. #11
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank You Cranial.

    Well, I'm getting to know the scripts and stuff but I'm still uncertain about whats XAMMP?

    and what do u mean by
    Then save .php scripts in the htdocs dir of the Apache install.
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....

  12. #12
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google mate.
    http://sourceforge.net/projects/xampp
    Xampp is a package to installing Apache, MySQL and PHP for you. It can be complex for a beginner to install them manually.

    Once Apache is installed it will have a folder called htdocs. This is where apache serves pages from.
    I think the default install location on windows is probably c:\program files\Apache Group\Apache but I could be wrong.
    You need to put your sites in the htdocs folder in this location.

  13. #13
    SitePoint Zealot Zafar Ahmed's Avatar
    Join Date
    Apr 2004
    Location
    Karachi
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, i'm starting to know how it works, i'll post here if i need some more help and so far you guys are really helpful
    Xenon Web Solutions -Web Development Company Based In Pakistan
    -As I walk through life....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •