By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

Advantages and disadvantages of PHP?

P: n/a
I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.

Please note, this is not a religious question. Programming languages
are tools to me. I just want information about where different types
of solutions are likely to be optimal.
Feb 17 '08 #1
Share this Question
Share on Google+
21 Replies


P: n/a
"Jonathan Sachs" <js******@sbcglobal.netwrote in message
news:dr********************************@4ax.com...
I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.

Please note, this is not a religious question. Programming languages
are tools to me. I just want information about where different types
of solutions are likely to be optimal.
Take your pick: PHP, ASP, ASP.NET, Perl, Python, Java, et.al.

What does your Web server support? What languages do you know?

The answer usually boils down to the above.

What Every Webmaster Should Know: PHP, Perl, ASP.net
http://www.seroundtable.com/archives/006709.html
Feb 17 '08 #2

P: n/a
McKirahan wrote:
"Jonathan Sachs" <js******@sbcglobal.netwrote in message
news:dr********************************@4ax.com...
>I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.

Please note, this is not a religious question. Programming languages
are tools to me. I just want information about where different types
of solutions are likely to be optimal.

Take your pick: PHP, ASP, ASP.NET, Perl, Python, Java, et.al.

What does your Web server support? What languages do you know?

The answer usually boils down to the above.

What Every Webmaster Should Know: PHP, Perl, ASP.net
http://www.seroundtable.com/archives/006709.html

And as usual, what fits your style and the application is better than
what is the Best Thing..
Coming from C I found PHP mainly good, but irritating because of weak
typing and inconsistency of syntax..this isn't a fault per se, just
something you have to be equally careful of as you do in wobbly if you
do operations on different types. In PHP they are invisibly converted
with sometimes unexpected results.

Its more than good enough for what I want tho..
Feb 17 '08 #3

P: n/a
On Sun, 17 Feb 2008 07:38:50 -0600, Jonathan Sachs
<js******@sbcglobal.netwrote:
>I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.
First, are you totally free to choose a language, or are there some
constraint somewhere that would narrow things down? For instance, if
you'll host your app on a shared server, just about every hoster
offers PHP, while other languages are much more rare.

If you'll be using your own server, you'll have to check if the app
has any dependency, in which case you'll have to check if those
externalities can be called from the language.

Finally, what language do you already know? In terms of productivity,
Python is probably the best, because it's very rich while offering a
very simple syntax, while PHP is much more common simply because it's
been offered by hosters for about ten years now.

The web is pretty restrictive in what you can do compared to desktop
apps anyway, because of the nature of HTTP and HTML, so ultimately,it
doesn't make much of a difference what language you choose on the
server. You can probably even write most of it in JavaScript and call
routines from the client through AJAX :-)
Feb 17 '08 #4

P: n/a
On Feb 17, 3:38 pm, Jonathan Sachs <js070...@sbcglobal.netwrote:
I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.

Please note, this is not a religious question. Programming languages
are tools to me. I just want information about where different types
of solutions are likely to be optimal.
As you asked for optimization, here is a list that i made, considering
investment & operational cost, and time saving features, etc. Ofcourse
i suggest open source, big companies like yahoo, google, nasa,
youtube, facebook,etc. use;

1-Python
2-PHP
3-Perl
4-Java
Feb 17 '08 #5

P: n/a
On Sun, 17 Feb 2008 16:23:34 GMT, Jonathan Sachs
<js******@sbcglobal.netwrote:
>I'll repeat that I'm guessing here. My guess is based on the fact
that PHP is (as far as I know) an interpreted language, while Java is
a JIT compiled language.
Does someone have data on whether JIT-compiled Java is faster than
cached PHP opcode?
>The fact that Java and C# are strongly typed languages may also have
an effect on the scalability of applications, as well as their
robustness and maintainability.
That's a good reason.
Feb 17 '08 #6

P: n/a
Jonathan Sachs wrote:
>

Speaking technically, it seems to me that PHP is likely to be a poor
choice for large-scale services where hundreds or thousands of users
will be hitting the web site at the same time. I'm guessing, though,
and I wouldn't know how to judge how large is too large. Perhaps
there are other areas where PHP is particularly weak or strong, which
I do not yet know enough to wonder about. Hence, my question.
The current trend eems to be to throw processor power and RAM at such sites.

If you have such, you probably would also have an Oracle Database
underneath, not MySql :-)

I picked PHP because I wanted fast prototyping of sonething running on a
cheap platform, for moderate traffic only.

Its actually pretty good. I am more bandwidth limited than processor
bound, and probably RAM would be the first thing I would add.

There is no doubt that writing in C would be immensely more efficient
than an interpreter, but then you have the usual compile/link/install to
do every time you make a change.

However there is no reason why you could not pretty much recode any time
critical bits into 'C'..r write a whole PHP library in 'C' that did your
clever bits.*

In the end execution efficiency is almost never a dominant issue..with
PHP, MYSQL and Apache, especially on a Linux OS, you have an ideal
platform that costs next to nothing to develop applications. A thousand
concurrent users hitting it would probably cripple it sure, but by then
you should have the money and the reason to migrate to something top
end, if that's what's needed.

I would regard the above as the de-facto standards for small to medium
website development.

*Where does one find out how to do this? I might need to one day...
Feb 17 '08 #7

P: n/a
Gilles Ganault wrote:
On Sun, 17 Feb 2008 16:23:34 GMT, Jonathan Sachs
<js******@sbcglobal.netwrote:
>I'll repeat that I'm guessing here. My guess is based on the fact
that PHP is (as far as I know) an interpreted language, while Java is
a JIT compiled language.

Does someone have data on whether JIT-compiled Java is faster than
cached PHP opcode?
>The fact that Java and C# are strongly typed languages may also have
an effect on the scalability of applications, as well as their
robustness and maintainability.

That's a good reason.
As is the difficulty of ripping off the source if for some reason the
3rd party server suddenly delivers pages of PHP source to you ;-)

It happens..
Feb 17 '08 #8

P: n/a
On Sun, 17 Feb 2008 14:16:25 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>You will find that often java is slower than PHP.

Don't guess. Get the facts.
Can you refer me to a source of information on this, or at least
explain why it is so?

I value facts, but I do not have the ability to pull them out of thin
air. The value of USENET lies in the ability of like-minded people to
share information, so that each person does not have to reinvent or
rediscover the wheel for him or herself. Please share a little.
Feb 17 '08 #9

P: n/a
Jonathan Sachs wrote:
<snip>
>
Speaking technically, it seems to me that PHP is likely to be a poor
choice for large-scale services where hundreds or thousands of users
will be hitting the web site at the same time. I'm guessing, though,
and I wouldn't know how to judge how large is too large. Perhaps
there are other areas where PHP is particularly weak or strong, which
I do not yet know enough to wonder about. Hence, my question.
I am not sure about the back-end, but at the front end, Facebook uses
Php and JS. Signing in takes you to the page below. Facebook's
popularity can be judged at Alexa.

http://www.facebook.com/home.php?

http://www.alexa.com/data/details/tr...s/facebook.com
Feb 17 '08 #10

P: n/a
Jonathan Sachs wrote:
On Sun, 17 Feb 2008 14:16:25 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>You will find that often java is slower than PHP.

Don't guess. Get the facts.

Can you refer me to a source of information on this, or at least
explain why it is so?

I value facts, but I do not have the ability to pull them out of thin
air. The value of USENET lies in the ability of like-minded people to
share information, so that each person does not have to reinvent or
rediscover the wheel for him or herself. Please share a little.
Because they are two different approaches to programming. Just because
java is precompiled doesn't necessarily make it faster. There are many
other things to take into consideration.

As I said - run your own tests.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Feb 17 '08 #11

P: n/a
On Feb 17, 5:38 am, Jonathan Sachs <js070...@sbcglobal.netwrote:
I'm a programmer learning PHP. I'm looking for some input on its
strong and weak points compared to other server-side programming
environments, e.g., Java Server Pages.

Please note, this is not a religious question. Programming languages
are tools to me. I just want information about where different types
of solutions are likely to be optimal.
Advantages:
- Open Source, readily available (you can be using it today) and dual-
licensed - if you are doing non-profit work or not licensing, there is
no cost.
- Very Easy to understand Syntax, some really cool features (arrays
are something else!)
- Interfaces very easily with Apache/MySQL
- Server side (no need to futz with client installs - only with
rendering issues if you use CSS).
- Lots of good source code out there to use and/or learn from, as well
as many useful libraries for working with PDFs, graphics, etc.
- Lots of good books and on-line help (php.net is great)
- Platform agnostic, can run on Windows Linux or Mac servers. Also
very scalable.
- Lots of hosting services have it ready to use, no special
configuration (except if you have special security needs)
- Pretty easy to access other web-based tools through PHP (i.e. google
maps, etc.)

Disadvantages
- If you want to do more than just HTML/CSS pages on the client you
need to also add javascript, java or other client-side language in
your output (goes for Perl and some other languages).
- The way browsers work make handling data and coding programs more
interesting (technically each page is a new run on the system, so you
have to manage your variables coming in and going out and between
pages. Not hard, just different.)
- Web programming (regardless of language) is open to security flaws
due to unimplemented or unknown vulnerabilities, takes a bit more
caution.
Feb 18 '08 #12

P: n/a
On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
(http://symcbean.blogspot.com/)" <co************@gmail.comwrote:
>One of the most convincing arguments I've seen for PHP is the stats at
http://shootout.alioth.debian.org/
So, in practise, what are the usual bottlenecks for PHP web apps?
Access to the DB? Hard-disk? CPU? Network?
I'd also be looking at Ants.
You mean www.ants.com ?
>Yes, I'd expect well crafted C (or even C++) to beat the socks off
PHP, but who has got that amount of time to spend writing functional,
secure code?
Besides, it'd be stupid to write very fast C code... but have the CPU
spend 99% of its time idle, waiting for bytes to travel in and out of
the network :-)
Feb 18 '08 #13

P: n/a
On Sun, 17 Feb 2008 22:01:12 -0800 (PST), la***@portcommodore.com
wrote:
>- If you want to do more than just HTML/CSS pages on the client you
need to also add javascript, java or other client-side language in
your output (goes for Perl and some other languages).
Isn't that true for all server-side languages? The OP asked how PHP
compared to other languages used to build web apps, not PHP vs.
desktop languages.
Feb 18 '08 #14

P: n/a
On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
(http://symcbean.blogspot.com/)" <co************@gmail.comwrote:
>One of the most convincing arguments I've seen for PHP is the stats at
http://shootout.alioth.debian.org/
Perhaps I misunderstand something about these results. I displayed a
comparison of PHP to Java ("Java 6 -server"). Considering all of the
benchmarks shown, PHP had a small overall advantage in memory use and
Java had a large overall advantage in CPU time.

I'm not familiar with the benchmarks, but their names suggest to me
that most of them are CPU-intensive -- not representative of typical
server applications. Thus I'll take the results with a bit of salt.
They suggest to me that for typical "real" server-side applications,
neither language would have a clear advantage.
Feb 19 '08 #15

P: n/a
Jonathan Sachs wrote:
Speaking technically, it seems to me that PHP is likely to be a poor
choice for large-scale services where hundreds or thousands of users
will be hitting the web site at the same time.
It seems to have worked well enough for Yahoo, Facebook and Wikipedia.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 21 days, 17:33.]

Bottled Water
http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/
Feb 20 '08 #16

P: n/a
On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster
<us**********@tobyinkster.co.ukwrote:
>It seems to have worked well enough for Yahoo, Facebook and Wikipedia.
I didn't know it was possible to load PHP pages that do not have
the .php extension. (I did not see the extension on any of the
Yahoo or Wikipedia pages I looked at. Facebook has them.)
Feb 20 '08 #17

P: n/a
Jonathan Sachs wrote:
On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster
<us**********@tobyinkster.co.ukwrote:
>>It seems to have worked well enough for Yahoo, Facebook and Wikipedia.

I didn't know it was possible to load PHP pages that do not have
the .php extension. (I did not see the extension on any of the
Yahoo or Wikipedia pages I looked at. Facebook has them.)
Have a look at Apache's mod_rewrite. It pretty much lets you do that sort of
thing.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Now listening to: Terra del Sol - Café del Mar, volumen diez (2003) - [9]
Sea Goddess (5:16) (98.083298%)
Feb 20 '08 #18

P: n/a
On Feb 20, 8:50 am, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.orgwrote:
Jonathan Sachs wrote:
On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster
<usenet200...@tobyinkster.co.ukwrote:
>It seems to have worked well enough for Yahoo, Facebook and Wikipedia.
I didn't know it was possible to load PHP pages that do not have
the .php extension. (I did not see the extension on any of the
Yahoo or Wikipedia pages I looked at. Facebook has them.)

Have a look at Apache's mod_rewrite. It pretty much lets you do that sort of
thing.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Now listening to: Terra del Sol - Café del Mar, volumen diez (2003) - [9]
Sea Goddess (5:16) (98.083298%)
Also, they are probably using a front controller/mvc that allows them
to have entries such as http://en.wikipedia.org/wiki/Model-view-controller
(which is typically coupled with a mod_rewrite-like action on the HTTP
end).

Regards,

Steve
Feb 20 '08 #19

P: n/a
Jonathan Sachs wrote:
I didn't know it was possible to load PHP pages that do not have the
.php extension. (I did not see the extension on any of the Yahoo or
Wikipedia pages I looked at. Facebook has them.)
An "extension" is a Windows filesystem concept.

Although most web servers by *default* map URLs to files on the server of
the same name, most can be configured differently. Strictly speaking, a
web server could be written that didn't even understand the concept of a
"file". (Of course, it would have to be running on an OS which was
similarly file-free.)

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 21 days, 22:00.]

Bottled Water
http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/
Feb 20 '08 #20

P: n/a
Toby A Inkster wrote:
Jonathan Sachs wrote:
>Speaking technically, it seems to me that PHP is likely to be a poor
choice for large-scale services where hundreds or thousands of users
will be hitting the web site at the same time.

It seems to have worked well enough for Yahoo, Facebook and Wikipedia.
You know, I keep hearing that argument, but I've never seen any
substantial evidence to back it up.
Feb 20 '08 #21

P: n/a
Tony wrote:
Toby A Inkster wrote:
>Jonathan Sachs wrote:
>>Speaking technically, it seems to me that PHP is likely to be a poor
choice for large-scale services where hundreds or thousands of users
will be hitting the web site at the same time.

It seems to have worked well enough for Yahoo, Facebook and Wikipedia.

You know, I keep hearing that argument, but I've never seen any
substantial evidence to back it up.
I just realized that my post could be read wrong - the argument that I
haven't seen substantial supporting evidence for is the argument that
PHP is not good for high-traffic sites.
Feb 20 '08 #22

This discussion thread is closed

Replies have been disabled for this discussion.