PHP versus Django or Others

This is nonsense. There are many massive sites built with PHP. Facebook

Not sure of the rest, but that's an interesting misconception. I doubt Facebook would work well on traditional PHP at it's current scale. While it's effectively coded in hack (php derivative designed for the HipHop VM), it's compiled to machine language JIT which makes it way faster. It's not typical php. The reason Facebook developed their own code platform was because the legacy php couldn't keep up with the demand.
 
Last edited:
Marsport has been trolling the forum in multiple threads today.
 
PHP:
var_dump('0xABCdef' == '     0xABCdef');


PHP:
true in 4.3.0 - 4.3.9

false in 4.3.10 - 4.4.9

true in 5.0.0 - 5.0.2

false in 5.0.3 - 5.2.0

true in 5.2.1+

false in 7.0.0a1


Behaviour of basic operators totally changing between bugfix releases, you can't get more PHP than that!
 
Php doesn't support multithreading, recommends nodejs...

Node is single threaded as well, it uses Async I/O and an Event Loop. Not exactly the easiest thing to learn how to manage properly as a beginner.

PHP and Laravel would defs be a good choice. Loads of support, and easy to use. Again as someone mentioned earlier, you can scale it, but you aren't going to win benchmark contests.

As a beginner, avoid going down the Fullstack JS route. It gets messy very quickly. This was my first major mistake when trying to learn development.

I am probably going to catch a bucket load of flack for this...
 
PHP:
var_dump('0xABCdef' == '     0xABCdef');


PHP:
true in 4.3.0 - 4.3.9

false in 4.3.10 - 4.4.9

true in 5.0.0 - 5.0.2

false in 5.0.3 - 5.2.0

true in 5.2.1+

false in 7.0.0a1


Behaviour of basic operators totally changing between bugfix releases, you can't get more PHP than that!
Been developing in PHP for a while and I never knew that. Interesting.
 
Just keep it simple.

Front end - HTML, CSS, Jquery, Vanilla JS. Plus maybe a css framework like Bootstrap & Bulma.

Back end - figure out what you'll feel most comfortable writing in.

In terms of "english-like" languages, go with Python or Ruby, in that case Django or Ruby.
They both have huge support online and a lot of libraries you can use to make developing it faster.


In reality... don't worry about scaling and those things now. If scaling actually does become an issue later on, it's actually a good problem to have. It means people love what you built! :)
 
Last edited:
If you don't have a lot of experience, stick with a batteries-included framework like Django or RoR for your backend. They make sure that you don't make a whole bunch of rookie errors.

As for your frontend. I think it is ultimately easier to go with a proper JS framework like React than to spend the time mucking about with HTML, Vanilla JS and CSS.
 
You barely know PHP, so continue learning PHP. Use Laravel or some framework. Design your database well.

If you keep switching tools for no reason, you're going to progress less.

If one day you actually finish the site in PHP that will be a major accomplishment - rewriting it minor by comparison.
 
Very often , the problem the OP mentions can be solved by infrastructure and money thrown at hardware , rather than rewriting code. Rewriting code is extremely expensive. Servers are much less expensive and can be deployed very quickly on something like Amazon AWS.

So...

Lets say that due to writing this thing badly in PHP , and because PHP is single threaded , and because making PHP multi-threaded is not that easy , you now have a problem where 150 concurrent users overloads the thing.

Option 1 : Rewrite in another language. Django is a python framework. Rails is a ruby framework. So now , you have to learn another language AND another framework AND rewrite the code. Meh. That will cost a lot , in terms of time or money or both. DaEvAnAm mentions PHP at 150 concurrent users and Python at 1000 concurrent users on the same badly written code. So , lets say you rewrite in Django or ruby and get 1000 concurrent users.
Result : You get 6x the number of possible concurrent users.

Option 2 : Get a 16 Core processor server with 2 threads per core. You can fire up one in Amazon AWS in 5 minutes to test.

There are cheaper options than AWS , but thats a good start. Deploy a docker image of your PHP/MYSQL server and code. You dont even have to build one. https://github.com/fauria/docker-lamp for example contains all you need.

Then fire up 32 instances of that docker image and run a load balancer between them (https://docs.docker.com/docker-cloud/getting-started/deploy-app/9_load-balance_the_service/)

Result : You get 4800 , (32x) the concurrent users without recoding anything.

This scales almost indefinitely. You can have PHP handle as many users as you like with bad code and its single threaded limitation.

Its not the tool per say. Its how you use it.
 
Very often , the problem the OP mentions can be solved by infrastructure and money thrown at hardware , rather than rewriting code. Rewriting code is extremely expensive. Servers are much less expensive and can be deployed very quickly on something like Amazon AWS.

So...

Lets say that due to writing this thing badly in PHP , and because PHP is single threaded , and because making PHP multi-threaded is not that easy , you now have a problem where 150 concurrent users overloads the thing.

Option 1 : Rewrite in another language. Django is a python framework. Rails is a ruby framework. So now , you have to learn another language AND another framework AND rewrite the code. Meh. That will cost a lot , in terms of time or money or both. DaEvAnAm mentions PHP at 150 concurrent users and Python at 1000 concurrent users on the same badly written code. So , lets say you rewrite in Django or ruby and get 1000 concurrent users.
Result : You get 6x the number of possible concurrent users.

Option 2 : Get a 16 Core processor server with 2 threads per core. You can fire up one in Amazon AWS in 5 minutes to test.

There are cheaper options than AWS , but thats a good start. Deploy a docker image of your PHP/MYSQL server and code. You dont even have to build one. https://github.com/fauria/docker-lamp for example contains all you need.

Then fire up 32 instances of that docker image and run a load balancer between them (https://docs.docker.com/docker-cloud/getting-started/deploy-app/9_load-balance_the_service/)

Result : You get 4800 , (32x) the concurrent users without recoding anything.

This scales almost indefinitely. You can have PHP handle as many users as you like with bad code and its single threaded limitation.

Its not the tool per say. Its how you use it.
Take into account, "upgrading" the code to PHP 7 will result in a large performance boost, just do that before even looking at anything else, near twice as fast for most cases.
1539256449781.png
https://gbksoft.com/blog/php-5-vs-php-7-performance-comparison/

There was a talk from the creator of PHP about it, love how he started it as a templating language.
 
Top
Sign up to the MyBroadband newsletter
X