Importance of PHP in web oriented platforms - php

Why is PHP the most used programming language for a web based platform?

PHP:
is easy to learn;
has been around for ~15 years;
runs fairly efficiently;
is cheap to host; and
actually scales really well (some of the largest sites on the internet use it).
PHP is basically the ultimate grass-roots success story.

PHP is:
Built for the web, that is not an extension of an existing language like Perl.
Free of any default framework; this allows it to be fairly lightweight and powerful, a good example of the KISS (Keep It Simple, Stupid) principle.

Because software that values simplicity over everything else propagates faster.

Probably because PHP is easy to learn and it was really simple at first start. With the upcoming of OOP from PHP4 we cannot really say it's simple anymore but at least it tries to keep simple.
Plus from the start the language was really Web oriented, easy access to get/post variables.
You can also note the PHP community is really wide and Zend do a great job to make it a real concurrent of Java/Dotnet/all the others.
Perl/Python/Ruby are also good scripting language but they require some libraries to develop web application

While most CGI language extensions require you to write HTML/JS/CSS within that languages syntax, PHP is able to be used within the contents of an HTML file structure. For someone who doesn't really get the concept of CGI (like I did a while back), it's really nice and offers room to grow with libraries and a universally familiar syntax.

It's also a strategic isue to
choose PHP over Java/Ruby/...
Because you will find PHP
programmers every time, but it is
really difficult to get (cheap)
Java/Ruby/... programmers.
PHP has become the third most be
liked programming language. * **
Its Open Source.
Its old and therefore very stable.
Its the best documented language in the internet.
It has the most string functions (necessary for web/HTML programming).
It has a very huge community, you will find the answer for every PHP question in the internet (or ask stackoverflow).
Its the only language which was designed for the internet.

PHP is fairly easy to install and fairly easy to understand. For that matter, you don't even have to install it. Fifteen dollars a month (or less) will get you a PHP webhost at hundreds of hosting companies.
There are no shortage of "Build a website in 5 minutes with PHP" books. Therefore, it's often the first choice to new web developers or people who want to get something done quickly.
PHP certainly has it warts, but done properly, it can be a good solution as well. Despite its warts, it runs an awful lot of successful websites.

I think it is easy to learn, it is faster, it has lots of forums, it has lots of example codes, it has ...

A lot of emerging php framework like Symfony, Zend, and Cake make rapid development, good mvc design easy. A lot of extremely popular blogging software/cms's are built using php eg. Drupal, Wordpress, and Joomla!.

Related

What are the relative advantages of various Python/PHP web frameworks (particularly for my project)?

I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested in web2py because of its jQuery integration.
About our project
Our project is to develop a security console for a complex
cybersecurity system operating within an organization's internal
network.
This console will be largely server-driven, as messages come in from the network and must be pushed by the server to the user.
The user will also be able to initiate security actions, the implementation for which will likely be in C++.
The interface we've planned will be relatively rich, and I want to leverage jQuery's power as much as possible.
We have some control over the browser environment we'll be running in (e.g., we don't have to worry about clients with JavaScript disabled).
Our site is likely to have only a few, long-lived client connections.
We are looking for software components with permissive licenses, though we're using some copyleft components (I see that web2py is LGPL while Django is BSD, so +1 to Django)
We have about a month to create a functional demo of our system, of which this interface is a small (but visible) part.
About us
We are two developers with about 5 years of programming experience, but little web development experience. I have several years of Python experience and a summers' worth of experience messing around with PHP. My coworker has some Python experience and has never touched PHP.
I used Django once back in 2008, and was frustrated by the file and code structure, which I found highly unintuitive. Perhaps this structure is inherent to the MVC model (I've had similar experiences with Django and CakePHP since), and I just need to bite the bullet and memorize it.
My Question
Given the information above, what are the relative advantages of the various Python/PHP web frameworks for our project? As mentioned above, I'm especially interested in web2py because of its jQuery integration, though Django's dominance is (once again) hard to ignore.
Thank you very much for your time!
Before deciding on a framework, you should first decide if you want to commit to a language you are unfamiliar with.
You said you've both got minimal PHP experience, so you have to weigh up the advantages here; Will the pros for going PHP (if any) out weigh the amount of time the developers will need to spend to retrain?
(Although depending on your background experience, PHP should be very easy to pick up.)
If you frame it like that, PHP would have to have a pretty convincing offering to give you. From what I'm seeing, specifically Django vs web2py, they both seem very close in functionality - which is good, but doesn't provide the "you must use x!" scenario you may be after.
However, If you will be bringing more people in later and feel finding people to work with web2py will be difficult, it may tip it to PHP. You said your self, Django's popularity (and BSD license) is hard to ignore, and it should make it easier to find people for later expansion.
If it were me, in your shoes, I would go with web2py. Assuming the development team will continue to be Python focused for the foreseeable future.
Python vs PHP: Python
With python, you can always write wrappers for C code so you won't have to mess with starting other processes and passing args to them. That might be useful for your security functions.
Web2py will allow you to easily write a webservice for this too, to more easily integrate the C portions with the web-site infrastructure.
If you already prefer python, I would go with that. If you need to bring on web-developers later that are trained in PHP, teach them Python. It won't take long, and I'm sure they'll appreciate it in the long run. Plus, moving from a PHP MVC framework to web2py or even django would make things easier. I've used CodeIgniter for PHP and find that web2py was so much simpler and easy to understand.
Also as for the directory structure, django is not actually true MVC -- it's MTV (model, template, view).
I find web2py's organization a little more straight-forward. But yes, either way it can seem strange at first. I would say YES, you should bite the bullet and use MVC.
In web2py, the "view" is html markup with the ability to write raw python code. The controller extracts data from the model (database), attaches any needed files (css/js etc) and the model of course simply defines the structure of the data and allows you to access it in an OO way.
Lastly, I wouldn't tip my hat in favor of web2py just because of jQuery integration. It does use it, and a some of the built-in framework stuff (like response.flash/session.flash, the LOAD function that loads a page or data from another controller) rely on jQuery, but using it in another framework only means you have to write an include statement (e.g. ).
But, the way it allows/forces you to focus on development is what takes the cake for me.
I've been using Django as part of my work for a couple years now and truly enjoy it when I can make it work. Unfortunately, and maybe it's just me, but I end up spending hours working on configuration every time I start a new server, or try to make it work in a development IDE.
It's relatively simple to start a new project and start coding. But there are all sorts of little catches that keep things from working if you deviate from the norm. Things like if you want your django project to serve from a subdirectory like example.com/django. The information is out there to make it work. But it's hard to find.
I can't tell you if web2py has those same problems or not. I only just learned about it from your question. It does look slick and simple though. I can tell you that after the hassles of getting the applications to serve properly from whatever server configuration I'm using, django is way more fun to program with than plain php. PHP frameworks may differ.
From my understanding the project not usual web application, you must need event driven program, web server in python.
Django won't help you here.You should look into Flask, Flask has inbuilt console too.http://werkzeug.pocoo.org/, you might need to use twisted, gevent,Flask jquery.
I would recommend asking about web2py on its mailing list -- you'll get lots of help and advice there. Regarding the LGPL license, note that it only applies to the framework, not your application -- you can license your application however you like, including closed source/commercial.
It sounds like you'll need some server push functionality, but if you'll really only need a few long-lived connections at a time, you might not need to bother with solutions like Twisted or gevent. If necessary, though, web2py does include this (requires Tornado, and works using WebSockets, though can be adapted to use other methods).

php vs python django or something else for CMS module

We're looking to develop a CMS module for our website and I need some help in choosing the language/framework for this project. Basically we need to develop a "help' module like this one from ebay http://pages.ebay.com/help/index.html which will contain a lot of static pages with nice URLs for SEO.
The application must run fast using low computer resources.
We have been looking to use php on a custom made mvc framework but we received advice from other sources that py/django is the exactly language/framework that we need in terms of maintainability and development speed because it was developed for exactly this kind of projects so I need an expert advice on this matter with pro and cons for each choice.
It comes down to what your programmer is comfortable with. If you don't have a programmer, find one and ask him/her what she's comfortable working with. The task you're describing seems pretty simple. It can all be done with straight php, python, ruby. Having used PHP, Java and Python, I have a preference for the latter. But as I said, the task is so simple that you can do it without problem in most languages. I suspect that you'll find much more developers familiar with PHP, so you might want to look in that direction.
As far as frameworks go, there again, I don't see much that would require the raw power of an entire framework.
static pages: you need a cms, either custom built or something really lean and dead simple.
clean urls can be achieved with url rewriting (e.g. apache modrewrite directives).
Again, hire the right developer and trust his/her input. Don't go and tell him/her how to work if you don't know how it's done.
I would not say that django was specially developed for this kind of project. There are also great frameworks in PHP like the Zend Framework or symfony, among others.
In the end it comes down to what your production servers offers (but I guess you are free here) and with which programming language you feel most comfortable.
But it is true that Python's structure and style of language makes it fast to program with. (But it probably makes no difference if you are able to program PHP in your sleep ;))

What are main advantages of RUBY and RAILS to PHP and CODEIGNITER

We are about to start a new Web2/AJAX app and are trying to decide if its worth the time and effort learning Ruby/RubyOnRails instead of PHP, CodeIgnitor and JQuery we currently use.
The key issues are clean/fast/modern AJAX UI, robust error handling, ans maintainability.
I would appreciate unbiased (if thats at all possible talking languages/frameworks) comments from experienced PHP and RUBY developers.
I can't say too much about Ruby, but I can say that I often feel like PHP gets a bad rap. PHP is what you make of it. Yes, there is a lot of awful PHP code out there, but you know, it was mostly written by people who would have written awful Ruby, or awful Python. PHP has such a wide audience that programmers of all stripes and abilities are using it, and many of them are writing bad programs.
That said, you can write good programs in PHP. Do you have good developers? If so, you can certainly write good code in PHP.
PHP has a terrible reputation because it is so accessible. Anyone can start writing PHP, and most hosting solutions offer PHP these days, so there are a lot of non-programmer types writing programs in PHP. These programs lack proper computer science discipline.
There is a very widespread movement within the PHP community to move toward readable, well formed code as PHP starts to adopt modern language features. With PHP5, OOP became a practical reality and with that an explosion of books and material written about OOP best practices and development patterns. While PHP is often used to write malformed sloppy spaghetti code, the language facilities are there to allow developers to program in development paradigms like MVC, OOP, and TDD.
Not to mention, PEAR has greatly improved the quality and accessibility of community scripts. PHP's strongest asset is its community, and it has been becoming stronger and more disciplined. In many ways, PHP is very much like JavaScript--it had a very sloppy beginning from which the developers and community have been trying to recover. JavaScript is a very sloppy language, but there are some extremely powerful parts of that language that have brought it some well deserved respect in the age of Ajax and interactive web applications.
Languages like Ruby and Python are chock full of things geared toward computer programmers. If you hire a Python or a Ruby programmer, just by virtue of knowing the language that programmer is many, many times more likely to appreciate clean, well organized code than a PHP developer. That is part of the culture of those languages, and the people who evangelize them.
There is nothing inherently better about Ruby or Ruby on Rails in my opinion. Rails was the first mainstream MVC development framework, but its popularity and success has catalyzed the development of similar frameworks in every language imaginable. The choice to write Rails in Ruby isn't an indication that Ruby is better than PHP, which many could argue. Considering the time in which Rails was written and 37signals' fascination with obscure things, I can understand the move completely. At the time, web scripting languages were pretty lame, and 37signals was looking for a language that catered more to the needs of application programmers, not scripters.
You're not being held back using a PHP framework like Zend Framework, CakePHP, or symfony. CakePHP and symfony are both directly modelled after Rails, even if they aren't direct ports. Akelos is an actual port of Rails to PHP. Zend Framework is the most fully featured framework I've used so far. Don't be afraid to experiment, but jumping ship to a completely different platform isn't necessary and it won't change the way you do business. It's the same business in a different dialect.
The most important feature of a language is how much you enjoy using it. If you enjoy the language that you use, not only will your life be better, you will write better code and be more productive. Of course, this is completely subjective; however, I've never heard any first-class programmers talking about how much they love PHP.
Of course, getting to the level of fluency in a language / framework combination that you really know whether it is going to float your boat takes a big investment of time. In my opinion, the time that you spend will make you a better programmer even if in the end you decide that you like a different tool better, so, go for it!
I think it's not about the language but the disciplines that are used in the community. If you are PHP developer who doesn't unit or functional test his code, nobody cares. There are bunch of PHP developers like that. If you are Rails developer and doesn't test your code automatically you're weird, something must be very wrong with you.
Ruby on Rails seems to me more than a framework, all the tools that come with the community. It is recommended that you use some kind of semiautomatic deployment tool like Capistrano. If you're not, you're weird again. And so on.
I agree with dicroce that you can shoot in your leg with both languages/frameworks. You could go with PHP and try to use some of the tools originally ment to Rails and i believe you get a great result.

Custom eCommerce Site - ASP.Net or PHP?

I currently have a very functional customised online ordering website written from scratch in ASP. This was built approx 4 years ago, and works exceptionally well.
I need to build a similar one for another company. Do I simply upgrade and get a like product developed in ASP.Net 2.0, or do I need to do some homework on other options such as PHP, Rails, Django, Magento etc?
The new site will need to use Ajax (or something similar) and other Web 2.0 features in which I know ASP.Net can handle.
Are there other simple frameworks available to create a customised online ordering type of application? As an example, I have heard that Rails and Magento are very difficult to customise etc.
Do I use the devil I know?
If you are looking at AJAX, then rather than vanilla ASP.NET, I'd look at ASP.NET MVC; this is a much cleaner model (more logical too, IMO) - and it plays very well with jQuery for the ajax, since you have much more control over both the html and the paths.
Also, jQuery now has intellisense in VS20008, making it even more inviting.
I can't comment on PHP - but the ASP.NET MVC is at least in roughly familiar territory. But note that ASP.NET (including MVC) is a lot more than just a straight upgrade to ASP.
I think it all goes around what level of focus and resource you intend to commit to this project.
If this is a project that you'll focus on solely for the next few years, then programming it yourself makes best sense, but if this is just one of many projects that you're busy with then I'd recommend trying something like Magento.
I was faced with a similar situation and chose Magento and that decision has been ratified many times over since then. Granted, there is a learning curve at the beginning, but you cannot compare the power of community developed projects against one you'll develop sporadically yourself. There have been a constant stream of improvements to the software, including iPhone-friendly shopping interfaces and ajax interaction, all stuff that I just would not have had time to get to.
Anyway, that's just my 30c worth.
Regarding which language to use if coding yourself, I think this is a purely personal decision and our responses can only be subjective.
But, since, you ask: I started web programming with ASP, but gave PHP a try over 7 years ago and have loved every minute of it.
If your current solution works and this new project doesn't require major changes and/or anything that you cannot do using ASP you should consider not switching but staying with ASP. Regarding AJAX, you shouldn't have any problem with the ASP.
My work is split between ASP.Net and PHP. I'd say , in general, I prefer the former for larger projects and the latter for small quick (in terms of dev time) things. In my experience, PHP's advantages over ASP.Net are cheaper hosting and larger user base (easier for the client to find someone to work on the app if you become unavailable in the future). If those aren't top priorities, I'd say stick with .Net. And definitely take a look at ASP.Net MVC and jQuery, as Marc recommended.
ASP.NET MVC all the way.
Easier port, more professional, safer and better for large projects.
This is an interesting question.
Comparing the Compiled vs interpreted languages - there is just a myth outside that PHP is faster than Asp.Net but at some points, this looks true. Find here a detailed explanation,
http://naspinski.net/post/AspNet-vs-php--speed-comparison.aspx
Moreover, the eCommerce site contains large number of products and database, so it should be wisely chosen the technology for development from these two, asp.net and PHP.
Check these pages if you would like to go deep in the selection of asp or php for eCommerce,
http://www.ydeveloper.com/asp-dot-net-ecommerce.html

Starting out doing server side things - what languages and techniques to choose?

I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my ignorance on server side programming.
So, what do I need. I need to get my head around how to use databases and how to use some server side programming language, I guess. What is the right choice? What should I avoid?
Thanks.
PHP and MySQL have a pretty low barrier to entry (they're both free and ubiquitous). I'd start with those, since most hosts provide them for you. As an added bonus, they work really well together (and PHP isn't very hard to learn coming from a web development background).
Head First SQL is a great book for learning MySQL. All of the examples in the book are done on MySQL. The book even explains where to get it and how to install it. As for PHP, the introductory tutorial at official website is the best place to learn it.
Update: Head First PHP & MySQL is now available. I haven't read this one yet, but other books in the series and by the same author are great for learning new languages from scratch.
Download Python. Learn the Python language. Learn Object-Oriented programming.
Python includes SQLite, this makes it easier to Learn the SQL language.
Download the Django framework. This makes it easy to write server-side applications that work simply and reliably.
I would suggest PHP. Not because it's the best, most modern or cleanest language out there, but because it is easy to learn for someone coming from pure HTML.
You begin by just adding tiny bits of PHP to your regular HTML and magic happens :)
Ruby is a fantastic language and the frameworks for web stuff generally teach you some good practices. Try it. The Learn to program book uses Ruby, maybe you'd like to check it out.
I noticed in your question you mention that you've been using javascript. If you're comfortable progamming javascript, I've recently begun working with server side javascript in the form of EJScript on linux and using jscript on windows. It's been fairly painless, and the documentation has been pretty good so far on both.
If you're more interested in learning this with another technology then Django & Python or ASP.NET & C# (or IronPython) are both fairly low barrier to entry platforms available on windows, *nix, etc...
I would say that if you're comfortable working in Linux, then go for PHP and MySQL. If you aren't comfortable working in Linux, then download the free Visual Web Developer version of Visual Studio Express, and get started using that. This lets you program in VB.Net or C#, and use the .Net web development framework. It's really miles ahead of anything PHP in terms of how nice a platform it is to work on. There's also a free developer edition of SQL Server that lets you store up to 4 GB of data.
There's plenty of .Net hosts out there now too. Although, due to increased license costs, Windows hosting plans will usually cost more and give you less space/bandwidth than Linux hosting plans, you can still get enough room to play around with and deploy some apps on the web. If you develop something really cool, and outgrow what your hosting account provides, it's probably time to upgrade to a VPS, and post ads on your site to start paying the bills
I'd recommend PHP for folks who are familiar with HTML but are newish to programming. Here's why:
I'm currently an ASP.Net developer, and I think that ASP.Net abstracts waaaaay to much to make it a good first programming environment. I say learn how to generate and manipulate straight HTML with a language like PHP instead of trying to understand GridViews, etc., which have no bearing or relevance to programming in the broader sense.
I wouldn't say ASP.Net is "the Dark Path" or anything, but if you start out by learning it, you'll tend to favor the warm and insulating arms of the framework. ASP.Net is pretty much a code-generator when compared to more explicit (some would say reckless, messy, and tedious, but I'm not one of them) methods like PHP.
With PHP you'll see the effect your code has on the actual HTML when you view source. With an ASP.Net page, you'll be baffled by the amount and complexity of the HTML it spits out.
After you get your hands dirty in PHP, you can explore the pros and cons of frameworks like ASP.Net that "do a lot of the work for you".
I was exactly in your situation 3 to 4 years ago and, like some of the commentators suggest, I tried PHP because of its low barrier of entry.
That was a mistake! Oh sure I was able to achieve some things here and there, including using a contact form from a book which was so flawed that it was later hijacked by big time spammers and got my domain banned from most email servers out there.
Later on I tried to learn how to create dotabase driven sites with object oriented programming following the guidance of the excellent books, blog posts, and forums from Sitepoint and other sources. It was just too hard for my little brain. I just could not do it.
So what happened? 2 1/2 years ago I decided to learn Rails, which had just turned v. 1.1. It has been fun since the beginning and extremely rewarding. Working with Ruby is a pleasure, much easier to learn than PHP, and the Rails framework is so well put together that you can, with little effort, produce some very elaborate web sites with advanced features all while learning how to do proper object oriented web programming.
I used my new knowledge to recreate from scratch the site of my non-profit organization (with a new domain ;-) and, with a friend who is a talented designer, created a web development firm.
Don't get me wrong, it's not that easy, if you want to learn programming you need to put a lot of effort into it but in my own experience Rails can bring you some instant results while letting you get deeper and deeper over time.
I recommend two main sources of knowledge:
The excellent, official Rails
guides.
The free screencasts
from Railscasts.
Whatever your choice will be I wish you the best and a fun and fulfilling experience
I recently came upon this question myself. I really liked the way PHP integrates with HTML making designing a site more natural in my opinion. Design your site as you would with static content and then switch the static with the dynamic. However, I wanted to choose a "good" language. I looked at PHP, Ruby, Perl, and Python, as they are the most popular, open source options. I didn't need any powerhorses, if you will, like Ruby on Rails or Django, since I just wanted to mess around with server side stuff and some SQL—nothing serious. I don't remember why nor do I care to remember why, but I chose Python. But I still wanted that integration with HTML. I came across Karrigell. It's a neat piece of Python that essentially handles the integration. It comes with a little web server which you can use on its own or use something like mod_proxy with lighttpd. The devs don't limit you to only Python inside HTML, though. Their server parses: Python inside HTML, HTML inside Python, plain ol' Python scripts, and Karrigell services. It may not integrate as well as PHP does, but it's pretty damn good.

Categories