473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Advantages and disadvantages of PHP?

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
21 14600
"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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: jj | last post by:
Care to enlight? Thanks!
1
by: Husam | last post by:
Hi EveryBody: I have research about advantages and disadvantages of C++ languages In one of my programming courses. Can Any one help me and told me about advantages and disadvantages of C++...
4
by: IchBin | last post by:
What are the advantages or disadvantages of .inc files over the 'include' statement. I can't seem to find that information at the PHP website. Also the same for form building inline, I guess you...
1
by: vumani | last post by:
what is the advantages and disadvantages of Ms SQL server and java servletts front-end on the clien end. what is the advantages and disadvantages of Ms Access on the server, connected via JDBC and...
1
by: vibee | last post by:
what are the advantages and disadvantages of normalization, and if i alread have a single talbe with a single form, is it too late to normalize thanks
8
hsn
by: hsn | last post by:
i would like to know what are the security advantages and disadvantages in HTML thank you
1
by: bantunks | last post by:
Hello, I am trying to figure out the advantages and disadvantages of exposing interfaces through Opaque data types in C. I have figured/found out the following two advantages 1. Higher level of...
3
by: Damodhar | last post by:
what is the advantages and disadvantages for register_globals = on
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.