PHP versus Django or Others

Shelldon

Active Member
Joined
May 30, 2012
Messages
53
Reaction score
0
Hi all.

Over the last few months I've been developing a website that I expect to have 1000's of users join. These users will either just query the website, whilst others will want to upload images (think TripAdvisor).

Now I've no coding experience, my day job is tour guide. I started by coding in php but as I get deeper into development my code has become more and more messy and complicated, where not even I actually know what I coded months ago.

Now whilst googling for examples to solve a specific problem I came across, I found some articles that were written in 2015 that basically said "stay away from php if building large scalable websites". After more googling, it seems that the common thought is to use Django or Ruby on Rails.

So I wanted to get your thoughts. Would you agree that going forward either Django or Ruby on Rails are a better fit for "large scale websites"? Is there perhaps an even better option?

Thanks in advance.

ps... Whether I actually launch my websites and get 1 user siging up or 20 billion is besides the point, I want to use the right code base regardless of the result :)
 
/in before "but [blah] is written in [blah]
 
Personally I'm no fan of PHP. Anyway, you can't compare PHP (a language) to Django or RoR (frameworks). You should rather compare Laravel to them.

There are a million ways you can do this. Writing the back end part of it in nidejs and the front end with something like React or Angular is a more modern and better way to go about it imo.

You can swap out the tech but the general idea should be: back end exposed via API, front end talking to API. Instead of node you can use go, c#, python with Bottle (Google bottle.py) or whatever you feel like.
 
Last edited:
There is rarely such a thing as "the right way" in IT. All the options you have listed, including the one you are currently using has been used to develop big websites. On the web, you will always encounter a lot of biased opinions, but in my experience, often the best tech is the tech you know, whatever that is at the time.
 
I'm not a developer, but I manage 2 teams of developers, one who uses PHP and Yii framework and the other uses Python and Django framework.

We built the same project, with 2 different teams, using the same specifications concurrently to see which framework, language and team worked out the best. Botth teams didn't know each other, or that we were doing this.

Conclusion was that the python and django team product a product that held up to 1000 plus concurrent connections while the PHP team and their platform handled 150 concurrent connections before the server just overloaded and died.

We basically got an outside company to review both platforms and provide us with advice on the route forward. Simple conclusion was that, while both platforms weren't developed well and both would have huge issues with scale and growth, that the scheme and code structure of the PHP team was better, but the framework just couldn't stand up to the task.

We're currently rewriting the entire system in PHP, using a combination of the 2 schemes and a combination of the 2 development teams.

Basically what i'm saying is - research the hell out of whatever you want to use and make sure you get it right, cause rewriting is an absolute pain.
 
1000's of users isn't a heavy workload for any framework.
PHP (incl. Laravel) can scale fairly well, but it certainly isn't going to win any benchmarks; re React or Angular; personally have no love for either: Facebook and Google are known to easily discontinue products; can you really bank on future support?
 
Elixir and Phoenix? Pretty Ruby syntax and extremely scalable, from what I've read.
 
On concurrency... Anyone can learn a programming language and write some code that does _____. That being said, few people can take this task and write optimized code that deals with it efficiently.

My personal point of view is that it is the developer that defines the quality of the application and not the language that was used to code it. True, some languages can deal with loads better than others but you can still use that language to write poor code that does not do the job well.
 
@Rewinder Let me simplify for you, OP should not be thinking that Y is more/less efficient at dealing with concurrency X. It's more often the case that if you experience these problems then it was not written correctly in the first place.

Anyways, as someone else said; It's hard to directly answer the question as the OP is a little confused on the subject. From my own personal experience with both Ruby and PHP. I'd say that he's better off sticking to PHP, opting to make use of a modern PHP framework such as Laravel over trying to learn a new language (especially complicated as Ruby) right now. With this new mind set attained, transitioning across to another language via another modern framework might be a logical step to make.
 
I don't want to start a whole new PHP thread just for this. Can I ask one of you for a quick bit of advice please. I have put this website together for someone and using PHP to send a Contact Us email. Email sends no problem but the comments, name, contact number etc are all on one line. How do I insert line breaks into this lot?

Code:
else {
mail( "$webmaster_email", "Feedback Form Results", 
  "Comments: " . $comments . " Name:" . $name . " Contact No:" . $contactno, "From: $email_address" );
header( "Location: $thankyou_page" );
 
I don't want to start a whole new PHP thread just for this. Can I ask one of you for a quick bit of advice please. I have put this website together for someone and using PHP to send a Contact Us email. Email sends no problem but the comments, name, contact number etc are all on one line. How do I insert line breaks into this lot?

Code:
else {
mail( "$webmaster_email", "Feedback Form Results", 
  "Comments: " . $comments . " Name:" . $name . " Contact No:" . $contactno, "From: $email_address" );
header( "Location: $thankyou_page" );

Have a look at example 4:

http://php.net/manual/en/function.mail.php

...

// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>
 
stay away from php if building large scalable websites
This is nonsense. There are many massive sites built with PHP. Facebook, Wikipedia, Yahoo, Baidu, Flickr. You can build big sites in any language. The important thing is to write your code well. Understand Big O notation. And then you need to use the right architecture. Know how to use caching. Then if you're really big, which you probably won't be soon, you look at load balancing and auto scaling servers, etc.

PHP, Python and Ruby are all perfectly fine choices. I like PHP because can build stuff with it very fast.

Saying all that though, if you're completely new, just jump in and start, and try to keep things as organised as possible. You're not going to do it right on your first try. These things can really only be learned through experience. Lots of it.

The best advice I can give is, learn the basics of PHP programming, and then use a framework. Frameworks will help you eliminate most of the stupidest mistakes newbies make. Laravel is a quick and easy framework to pick up.

Conclusion was that the python and django team product a product that held up to 1000 plus concurrent connections while the PHP team and their platform handled 150 concurrent connections before the server just overloaded and died.
What do you mean by concurrent connections? A PHP site is not supposed to have concurrent connections. Each page request has a beginning and an end.
 
What do you mean by concurrent connections? A PHP site is not supposed to have concurrent connections. Each page request has a beginning and an end.

Well - and I'm just taking a stab in the dark here - since PHP is executing server side and more than one person may try and access your site at the same time...
 
If you really anticipate your app will scale, then yeah, php is not likely the ideal tool. Why? Multithreading. There are other systems that do a way better job of multithreading like Asp .Net MVC - and visual studio is free for small teams and does a good job of multithreading natively. There are others (Django as you mentioned, and Node.js for example).

As others have alluded to - php is a language. With php, there are many many framework options to make the job easier. In the same way, Django is a framework for python and Asp .Net is a framework for a few languages including C#...

Some alternates to php for better scalability are Node.js and Asp .Net MVC. Visual Studio is a nice environment and seriously worth considering.

This is worth reading IMO.
https://www.linkedin.com/pulse/2014...t-what-you-should-really-be-comparing-instead

Also - if you want to consider Node.js - please take a look at the details behind the scenes and why Typescript was developed in the first place - it's very informative:

[video]https://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript[/video]

Also, sign up for Visual Studio Community and make use of the free vouchers for cloud services and training. If it's not your thing, it didn't cost a cent.

https://www.visualstudio.com/vs/community/
 
Last edited:
Php doesn't support multithreading, recommends nodejs...

.Net is now a framework to C# as Django is to Python...

Multithreading also apparently means scaling...

953af508876ee6e3d46420878b11eb1a.jpg


Think this thread has run its course
 
Last edited:
Php doesn't support multithreading, recommends nodejs...

.Net is now a framework to C# as Django is to Python...

Multithreading also apparently means scaling...
How'd you suck that from my post?

As for Django, .Net:
Django foundation said:
Django is a high-level Python Web framework
The Asp .Net explanation is in the context of Web app development which is what the OP wants, not?
Feel free to explain your points instead of providing a snarky post void of useful info.
 
Last edited:
How'd you suck that from my post?

As for Django, .Net:

The .Net explanation is in the context of Web app development which is what the OP wants, not?
Feel free to explain your points instead of providing a snarky post void of useful info.

Gladly...

If you really anticipate your app will scale, then yeah, php is not likely the ideal tool. Why? Multithreading.
...that's the scaling part

There are other systems that do a way better job of multithreading like C# .Net MVC - and visual studio is free for small teams and does a good job of multithreading natively. There are others (Django as you mentioned, and Node.js for example).
That's the multithreading part

others have alluded to - php is a language - within php, there are many many framework options to make the job easier. In the same way, Django is a framework for python and .Net is a framework for a few languages including C#...

...
...and that's the Django vs .Net part
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X