Opinions on using PHP for applications

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm learning to use PHP at the moment in order to establish its usefulness
for writing applications.  I would appreciate others' views on PHP's
abilities and other alternatives.

I am finding that PHP contains powerful programming functions but that it
lacks control of the the web page environment.  For instance, while it is
easy to build a complex page, there appears to be nothing to just run a
piece of PHP code and then return to the form, when the user performs an
action on the page.

My existing application is a traditional text-based environment, with
monolithic code, which I want to convert to a browser front-end.  Is PHP a
good or bad choice?

Re: Opinions on using PHP for applications

Jackie wrote:
Quoted text here. Click to load it


I'm not sure what you mean by "lacks control of the web page environment".  The
web server controls the environment; PHP and other languages run under that
environment.  So no language "controls" the environment.

You're looking at a different type of programming when you switch to a web
interface.  There's a bigger break between the client and the server.  To run
any server-side code, the user must submit a page to the server.  The server
then processes that page and sends a page (the same one or a different one) back.

Rather than ask if PHP is a good or bad choice - you need to determine first if
a web based front end is a good or bad choice.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Opinions on using PHP for applications

Jerry Stuckle wrote:
Quoted text here. Click to load it

Also, if you determine it's a good choice, check out Java script, DHTML,
and especially AJAX to learn about methods to combine a more dynamic web
front-end with a PHP back-end.

David J. Hennessy
http://david.maidix.com /

Re: Opinions on using PHP for applications

Quoted text here. Click to load it

Like any language, PHP has its good and bad points.  There are some
annoying inconsistencies in function-naming, there are some gotchas
like having to jump through a hoop to unset a global stem, basically
you need to learn where the mudholes are and not step there --
business as usual in the software world.

It's powerful enough to get the job done.  I don't fiddle with its
object-oriented facilities, I stay strictly within the basic
procedural function-set.

For an interpretive language it's decently efficient.  If you have
huge amounts of layered logic you'll probably want to do some caching
to speed things up.  Make as much use of builtin functions as possible
since they are compiled and run much faster.  If you're looking at a
site that requires millisecond response-times you might want to go to
a compiled CGI approach rather than using any interpretive scripting

Debugging server apps is kind of a pita, doing as much debug as
possible on your workstation is probably a real good thing.

You will need to learn which global variables contain information
about the request being processed.  PhpInfo() will be a great help in
doing that.

Beyond that, there are some basic weaknesses, if you want to call them
that, that are inherent in a browser front-end.  You have to learn to
wrap your mind around the idea of getting your inputs all at once from
a form instead of onesy-twosey as the user types them, that makes for
a different type of interactivity and usability issues can become more
critical.  You have to remember that your application becomes
time-segmented; that is, each browser/server interaction is separate
and you need to tie them together to build a consistent "application"
logic from the time-segmented interactions.  That means either cookies
or server-side session data, unless your application is simple enough
that each request can be processed atomically.

You said,

Quoted text here. Click to load it

That isn't entirely clear.  It may be that you haven't completely
wrapped your mind around the time-segmented nature of web apps.  You
can certainly use PHP to do pretty much anything you wish within the
browser/server framework; knowing what you need to do to achieve a
given effect is another question entirely.

Keep in mind that it's possible to combine PHP on server-side with
JavaScript on the browser.  I don't care for client-side scripting but
that's personal preference; it does extend your abilities to feign
some realtime interactivity that isn't possible if you stay strictly
within the browser/server block-data paradigm.

Best luck, if you get more specific then more specific answers will
become possible.


Re: Opinions on using PHP for applications

Jackie wrote:
Quoted text here. Click to load it

PHP is plenty useful in writing applications. There are plenty of
alternatives, each with their own limitations and benefits. A lot of it
ultimately comes down to your personal preference.

For early stages - beginning level web programming - I think PHP is
decent because it seems (to me) easier to pick up & start using than
many of the others.

Quoted text here. Click to load it

How so?

Quoted text here. Click to load it

It looks like you want to have the PHP code run something without
leaving the page the user has loaded in their browser. This limitation
is not specific to PHP, but is a result of the web environment. NO
server-side language can inherently do that.

In order to accomplish that (handling part of a page without reposting
the entire page), you would need to use Javascript and XMLHttpRequest.

Given where it appears you are in your learning, I would recommend
leaving that alone and concentrating on getting the PHP skills up.

Quoted text here. Click to load it

It's probably a decent choice.

Site Timeline