[Watford] PHP

walt walt at helvatron.co.uk
Sun Dec 2 10:23:23 GMT 2007


Thanks to both Neel/ Yvan,

Your advise is invaluable and interesting.  Like I said,  this is a
retirement project.  I have spent the last 17 years in IT installing,
setting up and fixing windows based systems, servers, workstations, networks
and cabling with long stints on the helpdesk in between and it was time to
do something more interesting which is why I started to play with Linux.
Should have done it long ago.

Anyway, just learning Linux/Unix without some sort of project is boring as
hell hence this need for me to produce something useful in the process like
some sort of web based application. Meantime I have refreshed my HTML and
JavaScript skills.

I’ll stick with PHP for now and then move on to Python and framework in a
few months, depending on progress. I'll try PHPEclipse on a spare machine so
I don’t screw up the working Suse10.3.

Many thanks again,   Walter
----------------------------------------------------------
From: watford-bounces at mailman.lug.org.uk
[mailto:watford-bounces at mailman.lug.org.uk] On Behalf Of Neel Upadhyaya
Sent: 01 December 2007 18:52
To: watford at mailman.lug.org.uk
Subject: Re: [Watford] PHP

You can actually tie php in with eclipse for interactive debugging using
something like APD or XDebug, I've never done this before as I prefer the
more traditional trace method but the PHPEclise package should have enough
to get you started. 

Personally I use both vi and Eclipse for my PHP work, both have their
strengths and weaknesses but knowing your way around an editor like vi means
that debugging on a remote server is a little less painful.

When looking at frameworks be careful you understand what you want from the
framework.  Something like the Zend Framework would give you the tools and
patterns to build a complex homegrown application/ framework whereas other
could lock you into a certain style that could be constrianing (although
it's worth mentioning that Zend does completely remove this issue). 

It's worth learning both PHP and Python but pick one for know and grok it
before moving on, personally I don't know much Python but it's on my long
list of new stuff to learn.  With the current state of PHP5 it's a much
better language than PHP4 ever was and can do most of the things the other
object based scripting languages can do. 
On 01/12/2007, walt <walt at helvatron.co.uk> wrote:
Great! Many thanks. I understand the technology no problem.

I have apache2 running and it picks up the index.html and displays the test
website without any problems.  I then installed the PHP5 module (or whatever

its called) and hey presto your sample scripts in index.php worked fine.
Ergo php must be kicking in.

So now to learning the language.  There must be oodles of documentation on
the web. But I may be picking your brains later in my learning curve if 
thats ok.

BTW: I am atheist with the motto live and let live.  So you have no worries
on that front.  I have read quite a lot about it all and although some of it
is well over my head I figured PHP looks like my best bet to start with. 
Should I get to point of where I start seeing the advantages of the other
technologies I will have no hesitation in using them.

I will need database access and if frameworks - django can do that I might
well switch to that in a few weeks.  I'll check it out. 

Are you going to the meeting (6th December) next week?

Thanks again, Walter

-----Original Message-----
From: watford-bounces at mailman.lug.org.uk 
[mailto:watford-bounces at mailman.lug.org.uk] On Behalf Of Yvan Seth
Sent: 01 December 2007 16:49
To: watford at mailman.lug.org.uk 
Subject: Re: [Watford] PHP

<quote who="walt">
> I usually use just a text editor for HTML and JavaScript which are
> very easy to debug in most browsers.  I have no idea how PHP does it. 
> There must something behind it that interprets and/or compiles the
> script.

PHP is entirely interpreted at the server-side.  The usual method being that
the web-server internally (typically with a loaded "module") executes the 
PHP interpreter over the "page" before sending the final generated HTML to
the client.  I.e. you have this in index.php on the
server:

    <html>
    <head><title>Silly</title></head> 
    <body><?php echo "Hello World"?></body>
    </html>

A web browser "hits" your page and the server reads the above off disc and
runs the PHP engine over it to generate this: 

    <html>
    <head><title>Silly</title></head>
    <body>Hello World</body>
    </html>

Which is then sent to the web browser.

> I thought an IDE would help understand it more easily. 

I'm not aware of IDEs for PHP that do much beyond syntax highlighting.
Though I rely on vi for all my editing and so I'm pretty clueless when it
comes to these GUI critters :)

> If I use gedit how to I run the script and debug it? 

Two ways:

1. a) You have a page with embedded PHP code: index.php
   b) You have the "php" command, on debian-sarge, for example, this
      comes from the "php4-cli" package.
   c) You execute: php index.php
   d) This spits out the HTML as it would be sent to the web client.

That's pretty ugly though (you get a bunch of HTML dumped to the screen).
Almost all PHP developers I've seen work with "live" systems: 

2. a) You have a web server installed with PHP support.
   b) You put your "index.php" within your web server's document tree.
      (And edit it in-place.)
   c) You visit the "index.php " via the web server with a web browser.
      (And hit shift-refresh to check things while you edit.)

This has the advantage of showing you the actual page as rendered, and you
can examine the HTML using Firefox's syntax highlighted "view source".  Plus

PHP natively generates error messages that render to web browsers.  (Also,
"tail -f <server-error-log>" is an invaluable tool when developing web
apps.)

You don't have to use your "live" website.  Typically you'll run something 
like Apache on your local machine and view it from the same machine with
http://localhost/blah/...php

> By the way, this is just a 'retirement project' to keep my brains 
> occupied and, maybe, create some web applications in the process. I
> will need MySQL database connections etc so I thought, after a bit of
> research, PHP is just the job.  We'll see; I might be better off 
> reverting to MS-Access and VB :-(

Personally I'm not a fan of PHP, but it is easy to learn and start running
with.  It could also be worth considering "frameworks" like Django
( http://www.djangoproject.com/), which makes it easy to build web
applications quickly (and I like Python).  Of course, this way lies
religious wars.  There's Perl (with, say, Mason), Ruby (Rails!), etc...

HTH
-Yvan



_______________________________________________
Watford mailing list
Watford at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/watford



-- 
MCSE is to computers as McDonalds Certified Chef is to fine cuisine. 




More information about the Watford mailing list