Is php still the defactor standard for web apps in Linux?

Red Squirrel

No Lifer
May 24, 2003
69,653
13,295
126
www.betteroff.ca
I've been toying with the idea of recoding most of my sites as some of the code is really outdated. My main site's code actually dates to when I was first learning php so some of the code is just terrible. I got thinking, there are other web languages such as Ruby On Rails out there. Are these worth looking into instead of php, or is php still the standard? Lot of the stuff interfaces with forums, so I'm thinking I should probably stick to PHP, but just want some opinions. From what I've seen they've stopped development on php, so I'm wondering if it's because they got it to the point where they are satisfied, or if the project is dead.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
I know a handful of people who work at Amazon and Google. They all work with Java. I work for a similar company, we use Java as well.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
PHP is the workhorse of the internet, seconded by java for the enterprise parts of the internet.

Ruby, python, javascript (node.js), etc are all niche players. While I think it's good to learn the latest fad, so you can keep yourself marketable, there will be php jobs for at least the next 40 years. Pick a tool you like and use it. I find myself sticking with php because of it's universal support, it can be hard to find a webhost with up to date rails.

As more cloud hosting shows up, I see this as less of an issue. So in the end, find a language and toolset you really like and make a career out of it.

Hell, I know a guy who was recently hired to write cobol.
 

velvetpants

Member
Aug 29, 2009
72
0
0
PHP is just one workaround on top of another over the original poorly thought out design. Then users of the language have to work around the workarounds in the language with more workarounds so your code will just be one massive workaround.
The best workaround in php is to work around php all together and use a proper language.

The sooner it dies the better. If you need to use it to maintain legacy projects, then fine, but for the greater good, don't start new projects with it.
 

Red Squirrel

No Lifer
May 24, 2003
69,653
13,295
126
www.betteroff.ca
So what is it's alternative, without using commercial stuff like .net and java? I may just stick to php anyway but I still want to see what alternatives exist. The nice thing with php is it's availability.
 

Train

Lifer
Jun 22, 2000
13,579
75
91
www.bing.com
So what is it's alternative, without using commercial stuff like .net and java? I may just stick to php anyway but I still want to see what alternatives exist. The nice thing with php is it's availability.

.net and java are commercial? both are free! Well, I'm not sure about java licensing since now it looks as though Google is going to have to cough up for android, but .Net compilers and usage has always been free, and if yuu are afraid of windows, there is an open source, cross platform implementation that has gotten quite popular.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
.net and java are commercial? both are free! Well, I'm not sure about java licensing since now it looks as though Google is going to have to cough up for android, but .Net compilers and usage has always been free, and if yuu are afraid of windows, there is an open source, cross platform implementation that has gotten quite popular.

Exactly. There is nothing you need to pay for.

I work on websites powered by Java (free) that run on Tomcat (free) behind Apache servers (free). We use MySQL (free) and Mongo (free) databases. We sometimes employ the use of memcached (free). We use all sort of free, open libraries.
 

beginner99

Diamond Member
Jun 2, 2009
5,310
1,749
136
PHP is just one workaround on top of another over the original poorly thought out design. Then users of the language have to work around the workarounds in the language with more workarounds so your code will just be one massive workaround.
The best workaround in php is to work around php all together and use a proper language.

The sooner it dies the better. If you need to use it to maintain legacy projects, then fine, but for the greater good, don't start new projects with it.

PHP has it's place and thats why it became so popular. It is perfectly suitable for small (= simple (CRUD like) and "low usage") Applications where using .net or Java would just not make much sense. Not all applications even in big companies must be "enterprisey".
 

Train

Lifer
Jun 22, 2000
13,579
75
91
www.bing.com
PHP is so slow Facebook had to create a PHP to C++ compiler so that they wouldn't have to buy twice as many servers.

Why they didn't just switch to another language is beyond me. maybe that had too much legacy code in PHP and didn't want to retrain all their php guys in something else, which could take a year.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
PHP is so slow Facebook had to create a PHP to C++ compiler so that they wouldn't have to buy twice as many servers.

Why they didn't just switch to another language is beyond me. maybe that had too much legacy code in PHP and didn't want to retrain all their php guys in something else, which could take a year.

That's one the nice things about having a service oriented architecture. The various services can all be written in different languages allowing you to change technologies over time.
 

velvetpants

Member
Aug 29, 2009
72
0
0
So what is it's alternative, without using commercial stuff like .net and java? I may just stick to php anyway but I still want to see what alternatives exist. The nice thing with php is it's availability.
You mean availability as in the ability to find hosts that support it?
I don't think you'll have a problem with RoR or python.

Ruby on rails is getting increasingly popular.
Python as well with web frameworks like django, pyramid/pylons and others.
All these frameworks have at least one advantage over PHP and that is that they are built on top of well structured, mature and widely used programming languages that have been around for some 20 years and are still in active development.

I know PHP has been around for as long, but calling php mature is like calling a jobless 40 year old, living with his parents, mature.

At least try something else before shooting it down. Worst thing that could happen is that it improves your programming skills.

PHP has it's place and thats why it became so popular. It is perfectly suitable for small (= simple (CRUD like) and "low usage") Applications where using .net or Java would just not make much sense. Not all applications even in big companies must be "enterprisey".
There are lot more things than .net or java that can be used for web dev with great efficiency.
Though, if you're just hacking together some functionality for a relatively low traffic, semi static website, something that wouldn't need to be maintained much... then php could work out allright.
But just because something isn't "enterprisey", that doesn't mean you don't want it to perform and scale well and be easy to maintain... or not frustrating as hell to write

What was that function called 'array_search', or was it 'arraysearch'.. do I put the needle first or the haystack. You don't have this shit in sanely designed languages.

PHP is so slow Facebook had to create a PHP to C++ compiler so that they wouldn't have to buy twice as many servers.

Why they didn't just switch to another language is beyond me. maybe that had too much legacy code in PHP and didn't want to retrain all their php guys in something else, which could take a year.
It takes a shitload of resources to rewrite something on the scale of facebook in a new language, regardless of how bad the original language is it's sometimes easier/cheaper to just tweak it best you can and throw more hardware at the problem.

Though I'm sure if Zuckerberg was doing it all over again today, he probably wouldn't go with PHP.
 

dwell

pics?
Oct 9, 1999
5,185
2
0
One more downvote for PHP. It had its time and place, but that was a long time ago. Avoid PHP.

node.js and Express seem to be the flavor of the month. Server-side JavaScript is gaining in popularity.
 

beginner99

Diamond Member
Jun 2, 2009
5,310
1,749
136
There are lot more things than .net or java that can be used for web dev with great efficiency.
Though, if you're just hacking together some functionality for a relatively low traffic, semi static website, something that wouldn't need to be maintained much... then php could work out allright.

Exactly. For an "application" that has like 2-3 pages and 10 users a day, php seems a good choice.

I agree that naming convention in php are crap. But then any half-decent IDE has "autocomplete".

I see the limitations of PHP but why use a Porsche in the city when the bike will get you there faster? Same as you would never use a bike to transport 40 t of steel.
 

Red Squirrel

No Lifer
May 24, 2003
69,653
13,295
126
www.betteroff.ca
I'll give ruby on rails a try I think, and did not realize there was server side javascript, or is that specific to .net? I really don't want to use .net just because I prefer Linux and while it can work in Linux the solution (mono) is just a giant workaround for something that should be running in Windows, and is probably against MS's ToS anyway. Rather use something that is native to Linux and supported by an open source community. I'm not too too concerned about host availability as I host most of my own stuff anyway, but it's something I'm still keeping in the back of my mind.

Come to think of it, what about straight C++? Is there an approved/proper way of writing web apps with it? (at least, specific to Apache) I imagine it would be insanely efficient and C++ has nice OOP that php definitely does not have. One of the things that is making me reconsider php is exactly that, php's OOP kinda sucks.

Come to think of it, an awesome project to take on would be to write a web based language, based on C++. I might do it some day just as a fun learning experience.

But yeah given the downvotes php seems to be getting, I think I'll definitely consider switching off it.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
I'll give ruby on rails a try I think, and did not realize there was server side javascript, or is that specific to .net? I really don't want to use .net just because I prefer Linux and while it can work in Linux the solution (mono) is just a giant workaround for something that should be running in Windows, and is probably against MS's ToS anyway. Rather use something that is native to Linux and supported by an open source community. I'm not too too concerned about host availability as I host most of my own stuff anyway, but it's something I'm still keeping in the back of my mind.

Come to think of it, what about straight C++? Is there an approved/proper way of writing web apps with it? (at least, specific to Apache) I imagine it would be insanely efficient and C++ has nice OOP that php definitely does not have. One of the things that is making me reconsider php is exactly that, php's OOP kinda sucks.

Come to think of it, an awesome project to take on would be to write a web based language, based on C++. I might do it some day just as a fun learning experience.

But yeah given the downvotes php seems to be getting, I think I'll definitely consider switching off it.

If you're even considering something like C# or C++, look at using Java servlets.
 

dwell

pics?
Oct 9, 1999
5,185
2
0
Come to think of it, what about straight C++? Is there an approved/proper way of writing web apps with it? (at least, specific to Apache) I imagine it would be insanely efficient and C++ has nice OOP that php definitely does not have. One of the things that is making me reconsider php is exactly that, php's OOP kinda sucks.

Well, that's basic CGI. C++ sounds efficient and at a code execution level it indeed is, but there's a lot of you'll sacrifice for performance. For instance, if a Java or Ruby script crashes you get a nice stack trace. While C++ can get you that it requires a little overhead and coding around with backtrace(), etc.

Also, there's a ton of frameworks for Ruby, Python, JavaScript and the other dynamic libraries. The benefit of being able to change a line of code in your script and execute it on a page refresh outweighs the performance boost C++ will give you. You don't get that with Java unless you use JSPs.

And at the end of the day, languages like Java and C# have JITs which compile down to machine code anyway, so a script getting hit heavily in Java say is probably executing within 90% efficiency of the C++ code.

I personally would not want to write web code in C++. YMMV.
 

velvetpants

Member
Aug 29, 2009
72
0
0
sigh, the anti MS/.Net assumptions are astounding among linux users.
I just don't like using closed source languages and frameworks.
So that when I run into a bug or am doing unconventional things with it, I don't have to guess how the code I'm calling works and go through massive trial and error sessions trying to figure it out, I can just read it (or modify it).
 

velvetpants

Member
Aug 29, 2009
72
0
0
.Net is free, and runs on free OS's

Free and free are two different words. You don't have to pay for .net, but you aren't free to look at the source code, modify or distribute it.The latter is the "free" that matters.
Some chunks of .net are open source now, but I don't think you're even allowed to look at it outside of visual studio, and you're not allowed to use it for non-windows applications (though I haven't read the full license).
 

Train

Lifer
Jun 22, 2000
13,579
75
91
www.bing.com
but I don't think you're even allowed to look at it outside of visual studio,
lol what?

and you're not allowed to use it for non-windows applications (though I haven't read the full license).

Again, lol, WHAT?

MS is actually one of the biggest contributors, and financial donors, to the mono project.

Like I said, some of the anti-MS assumptions from linux users are ASTOUNDING
 

velvetpants

Member
Aug 29, 2009
72
0
0
Well, as says in mono's contributor rule no1
If you have looked at Microsoft's proprietary implementation of .NET or their shared source code (which is also proprietary), you will not be able to contribute to Mono. If you would like to contribute in this area, be careful to not look into them in Visual Studio debugging experience.
Doesn't exactly spell out ".NET is free"

I know MS has released some things FOSS, but lot of .net is completely closed and other parts are only available for debugging purposes through VS (officially) using a very restrictive license.

MS is actually one of the biggest contributors, and financial donors, to the mono project.
What's your source for that? As far as I can tell, all MS do is passively allow it to exist.

That said, I like the direction MS is heading in this area. But that doesn't make up for all the shit they've done in the past.