This is a discussion on Advantages and disadvantages of PHP? within the PHP Language forums, part of the PHP Programming Forums category; On Feb 17, 5:38 am, Jonathan Sachs <js070...@sbcglobal.net> wrote: > I'm a programmer learning ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Feb 17, 5:38 am, Jonathan Sachs <js070...@sbcglobal.net> wrote:
> 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. |
|
|||
|
On 17 Feb, 18:41, The Natural Philosopher <a...@b.c> 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. 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. > One of the most convincing arguments I've seen for PHP is the stats at http://shootout.alioth.debian.org/ Combined with the fact that PHP is generally considered a very easy language to learn, it consistently scores very highly in number of lines required to solve a problem (i.e. it doesn't need a lot). The other languages which score well in this area are not well known for their simplicity. For 99.9% of applications, programmer time is more expensive than hardware - so its more effective to solve performance problems by throwing hardware at the problem (NB there is NO substitute for good programming in keeping costs low and performance good though). When I'm not programming in PHP I look after a large-ish Java site. While on paper, the semi-compiled Java should be a lot faster, at least here, there's no performance benefit. > If you have such, you probably would also have an Oracle Database > underneath, not MySql :-) > ! Not if performance is a concern. If I was starting from scratch developing a large system with performance as a concern, Oracle would be well down on my list behind MySQL and Sybase. (If you want to see why go visit the vendors sites and compare performance). I'd also be looking at Ants. > 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. > 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? C. |
|
|||
|
On Feb 17, 5:14 pm, Jonathan Sachs <js070...@sbcglobal.net> wrote:
> On Sun, 17 Feb 2008 15:27:05 +0100, Gilles Ganault <nos...@nospam.com> > wrote: > > >First, are you totally free to choose a language, or are there some > >constraint somewhere that would narrow things down? > > Either/or. I'm not asking in the context of a particular project or > client. I'm looking for guidance on when to select this tool and when > to look for another. > > Right now I'm learning PHP because I want to learn a particular > application that is written in it, and also because these days it > appears to be a basic development skill. I am trying to assess what > role it will play in my professional life. > > >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. > > The hosting service I use offers ASP.NET even with its least expensive > e-commerce plan, at $13.95/month. I don't know how common that is, > but for me, it establishes that alternatives are readily available. > > Of course, a particular client or its preferred hosting service could > limit me to PHP, which would determine my choice of language if I > wanted to keep that client. > > >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. > > Well, let's see. My background is mainly in PC software development, > which influences the languages I know. Starting with the most recent, > C#, JavaScript, Java, C++, Visual Basic for Applications, C, FORTH, > BASIC, PL/1, SNOBOL3, BAL, FORTRAN IV. Plus a few minor ones that > I've forgotten. > > >The web is pretty restrictive ... so ultimately, it > >doesn't make much of a difference what language you choose... > > In a strictly technical sense that may be true, but many other > considerations come into play. You've mentioned a couple: support by > hosting services and compatibility with applications. I might also > have to consider maintainability, portability, and acceptance by > clients at various levels of technical sophistication. > > 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. PHP is poor? YouTube and Facebook runs on PHP dude.. |
|
|||
|
On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
(http://symcbean.blogspot.com/)" <colin.mckinnon@gmail.com> wrote: >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 :-) |
|
|||
|
On Sun, 17 Feb 2008 22:01:12 -0800 (PST), larry@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. |
|
|||
|
On Mon, 18 Feb 2008 01:46:19 -0800 (PST), "C.
(http://symcbean.blogspot.com/)" <colin.mckinnon@gmail.com> wrote: >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. |
|
|||
|
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/ |
|
|||
|
On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster
<usenet200801@tobyinkster.co.uk> wrote: >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.) |
|
|||
|
Jonathan Sachs wrote:
> On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster > <usenet200801@tobyinkster.co.uk> wrote: > >>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%) |
|
|||
|
On Feb 20, 8:50 am, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.org> wrote: > Jonathan Sachs wrote: > > On Wed, 20 Feb 2008 11:31:05 +0000, Toby A Inkster > > <usenet200...@tobyinkster.co.uk> wrote: > > >>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 |