Hello PHPers. This is my first time back to these forums in a number of years, as I am currently working on starting a business designing and developing web applications.
I've been immersing myself in all the new technologies that have cropped up for the web over the last three to four years (I was stuck doing backend work, and haven't touched a "real" web site in years...all I ever did was write REST APIs with MVC.) My background is in C#, .NET, and ASP.NET MVC. I feel I have a LOT of power in these technologies, especially when combined with newer tools and platforms like HTML5, CSS3 (+Less), Twitter Bootstrap, etc. I am also intimately familiar with all of the .NET platforms libraries, both official and third party, as well as extremely well versed in C#...so it takes little effort to code apps on that platform. Combined with WinHost (which clocks in at $4.11/month), it has become a very cost effective platform for the power it offers.
It seems that the two real giants in web development, however, are PHP (still...its been big since the early 2000's) and Ruby. As someone who aims to offer my services to as many customers as possible, I've begun looking into PHP and possibly Ruby as alternative platforms, just in case a customer insists on hosting on a server other than windows. My question about PHP is, quite simply, why? What draws so many developers to use PHP over something else, such as Java or .NET? What are the benefits over other technologies? What are the drawbacks? In terms of capability, how does it fair? In terms of ease and rapidness of development, how does it fair? Why choose PHP over Ruby? How cheap is hosting for PHP?
Because PHP is FREE.
Because PHP is use by 90% of web hosting companies, around the world.
Which is not the case for .NET or Ruby.
PHP is robust and easy to learn.
I know asp is free too but .net is not.
To be fair, .NET is FREE too. You don't have to buy Visual Studio to develop in it, it is freely available for download/installation, you do have to buy a license of Windows Server to host it though, but .NET itself, is FREE (and you can technically host it on other platforms through Mono).
1) Most inexpensive hosting providers offer LAMP stacks.
2) Documentation and community support is another big reason why PHP remains popular. Other languages lack in this a little bit.
3) It's been around for a long time and has a solid foothold in the development community.
4) It has a low bar to entry.
Sorry, I did not know it's free too.
Thanks for correction.
That's the advantage of PHP I guess It can be hosted on LAMP, which is free.
In my humble opinion...
- PHP is easy to learn
- PHP is open-source
- You can easily deploy your PHP-based applications to most hosting companies
- Hosting is cheap
- PHP is matured compared to other scripting language like Ruby
- Great community
No worries, it is a common misconception everyone has about .NET since it is a Microsoft Technology. Just for kicks and giggles, I'll play devil's advocate and list reasons why .NET may be preferred
- Strongly tied to OOP, so you are forced into learning good practices, patterns, etc.
- Well thought out life cycle implementation for building pages (makes you think along more of MVC and MVP practices)
- If you have any experience in lower level languages, C, or C++, or even Java, transitioning to C# is dead simple
- Compile errors/warnings give you a hint at where your code may fail (or will fail)
- Can be used to develop Mobile and Desktop applications as well as Web
- Several libraries built in for you to do common tasks (email, caching, parallel activities, etc)
Why asking a question like this on a PHP forum/section?
I prefer PHP because it has more benefits they are
easy to use
easy to understand
easy to learn
easy to fix problems
free of cost
supports all major web server
supports all major database
Good PHP community
easy deployment and so on.
Many of these are subjective and not necessarily unique to PHP.
Can be said the same for PHP (desktop yeah, not 100% sure on mobile native apps)
I personally wouldn't go for a language just because its the cheapest to host. These days, the cost difference is negligible, most decent quality hosts would provide PHP & Ruby out of the box, a lot of them would also throw in Python in the same plan.
Maybe so, but you can't say it is stable and mature like you can for .NET. Desktop apps created by PHP are still in their infancy stage, in fact, most of the development behind them dies after a year or two (then another one crops up).
As for the libraries, I've yet to find a nice parallel library that comes close to matching the power of the .NET one. I honestly don't think it exists...
No I can't; .Net was made with that as primary purpose, PHP was made to run on the web, both of them excel at what they were primarily made for.
Hah, they've been so for ages. PHP GTK is still alive if somewhat, then there are some others like phpdesktop etc.
pthreads is quite good from what I've read, its a native pecl ext. Google have their own implementation as Task Queues on App Engine. A lot of people use their own home-grown libs which use exec() to run background processes when they want to do multi-threading. Personally I think if I need async/multi-threading then Node.js would be better than anything else.
It doesn't. PThreads looks to show some promise but I haven't tried it yet. I can't wait to gain a full understanding of GoLang which masters it.
One slight correction, .NET was made with both desktop and web in mind from the get go. Prior to the .NET framework, there was a bit of mixing but you primarily had ASP versus VB6 versus C++, etc. But yes, PHP was definitely designed for web, however, I do agree that as PHP becomes more OO desktop integration will become easier.
PHP GTK was one of the first ones I played with, and I did find phpdesktop and winbinder when I did a search before posting my statement, so I did do a "bit" of research, and I hope one day some perfects PHP on the desktop, it would be nice to be able to quickly throw a GUI together that is cross compatible with much less effort than working in Mono (although that has improved greatly over the past couple of years too).
I'll have to try pthreads the next time I need parallel processing (in fact, I may convert one of my own projects to use it to speed it up as a good test). I'm not a huge fan of having to use external systems/apps to achieve parallel processing (or languages), simply because you then segment your development force and increase your dependencies all for something that really should (could) be "baked in". Call it a personal bias if you will, but I just don't like having to do that!
Don't get me wrong, I also believe in "pick the language that fits the job" but if you mix and match, it just gets ugly. For example, where I work someone thought it'd be cool to do our rating engine in F# and the rest of the project in C#. F# is very well suited for a rating engine, no argument there, but the problem quickly became only a small handful of devs knew F# well enough to fix and continue to maintain the rating engine. That meant they really couldn't do anything else, and when they had to, they knew nothing about the rest of the system. Same was true for the C# devs, when they had to work in the F# projects, they really didn't understand it well enough to make good changes. In the end, the F# code was eventually replaced with C# to allow the devs to jump in and out of each project with ease.
More often than not, I can't do that with PHP. I always need to utilize another tool, another language, another application, etc to complete a task... It just frustrates me to no end on how often I must do those things. I'm not saying that never happens with .NET, but it happens far less often (to me at least, that may not be true for others in specialized areas).
Don't get me wrong, I love PHP, but I'll also be first to admit, I hate PHP. I don't love or hate .NET, I simply "like it". I just wish I wasn't always feeling like I was pushing PHP's limits/boundaries whereas, with .NET I seem to always feel like there is still another level or two I can take it before those boundaries/limits become apparent.
Yeah I know what you mean. I just hope it doesn't go the way Java did with native UI & swift UI. From the looks of it phpdesktop is something I'd want with chromium embedded into it, then if I want to build a desktop app all I'll need to do is make the UI in HTML5/CSS3 and JS something which is already familiar and the only learning curve would be the container API to interact with host OS.
In a usual generic case, mix & match can very possibly get ugly, un-maintainable, & a big pita. But then again, it might not. Use cases vary and so does architectures and the goals which drive toward the mix-n-match philosophy. I've seen examples of this work on a very big scale and I've also seen cases where it caused more problems than it was worth fixing them.
Out of curiosity I have to ask, (besides multi-threading and desktop/native mobile apps) any examples of stuff that you want to do but can't in PHP?
Completely Agree! That'd be cool.
Return Types! I despise there isn't a way to force a return type as this renders Interfaces to be nearly useless and Interfaces are a big deal when you are working on APIs or Services or working with a Third Party Service. As it is today, I can't trust anything I get back from a function, class, whatever. I have to validate that it is an array or a number or an array of class X. Drives me crazy.
I primarily find myself needing a good parallel library in PHP, one that doesn't require additional software or configuration (so it can run on a variety of hosts). Most of my time in PHP is spent on "special" projects. Strange projects that are no where near designing a website, CMS, e-commerce, etc. They are usually always interfacing with other services or systems and have almost always would have benefited from having a parallel library.
PHP is fairly robust and can manage to do a lot, I just seem to work in the sector that is long forgotten or "not as common" and so the key components I need, aren't there. I really don't mind that it can't do Desktop applications, that isn't a real bother, it just identifies one reason you may choose .NET or Java over PHP for a particular job. If you need to run things in parallel, you may want to use .NET (unless you are knowledgeable about beanstalk and php and how they tie together, or golang, or you have experience with pthreads).
I think it'll be added sooner than later, the parameter types for functions finally made it through. This stuff can be frustrating for those coming from .Net or Java etc but for someone who's been doing PHP for years, they usually take it in stride.
Seems like multi-threading is what work on most in PHP. You do have my sympathies!
Php it's like a tool that gives you everything and all features by little investment in terms of time, energy and money. but one bad thing about php , it is not well decorated or organised language compare to java , .net, that irritates me . Still way better than doing 100 lines of coding ,when it can be done in 40 - 60 lines using php
next page →