• 0

php or python for web development?


Question

I am trying to get into web development and I have been researching the different languages that I can use to start learning these things. I have a little bit of php knowledge, enough to allow me to make customization and changes to some things in wordpress but not enough to really do anything with it.

With so many different languages that can be used to code websites I am confused what would be the best one to chose to start learning. I have read good things about django (python) and how it is a better language that is more cleaner for bigger scale projects and that such. php is more widely used/supported and basically ready to go out of the box, however it has its own set of problems also. The more I read about the two different languages, the more I get indecisive.

Can you help sway me in the right direction?

Link to comment
https://www.neowin.net/forum/topic/1115375-php-or-python-for-web-development/
Share on other sites

Recommended Posts

  • 0

I don't really think there is a 'best' option, you can write clean well-structured large scale web applications in pretty much any language as long as you follow good coding practices.

Personally I use Ruby/RoR or ASP.NET MVC (not web forms) for any new projects. I used PHP for 6-7 years before that and contributed to the interpreter... but I'm much happier with Ruby & C#, there's a ton of bad design/annoyances/inconsistencies in PHP. There are some good upcoming PHP frameworks such as FuelPHP and Laravel although obviously they can't fix the underlying annoyances with the PHP language.

I would recommend just spending a while with each language/framework learning the basics / experimenting until you find the one(s) you like best.

  • Like 2
  • 0

I would personally recommend PHP as I'm currently using Laravel for a few projects (a few customer sites and some of my own projects.). But PHP was the first web development language that I learned ... so I'm always following PHP more so than lets say Ruby or Python.

  • 0

Ehh, it's good to know both, and starting with something like Python might let you avoid pitfalls you'd hit if you start with PHP (Which seems to welcome bad practises through it's bad design :shifty: )

That said, Python and PHP run quite differently (PHP normally runs in-process with the server, Python runs outside), while you can setup PHP to behave like Python it's a fair bit harder.

  • 0

Ehh, it's good to know both, and starting with something like Python might let you avoid pitfalls you'd hit if you start with PHP (Which seems to welcome bad practises through it's bad design :shifty: )

That said, Python and PHP run quite differently (PHP normally runs in-process with the server, Python runs outside), while you can setup PHP to behave like Python it's a fair bit harder.

PHP only runs in process with the server IF you are using Apache/Mod_PHP,,, otherwise you use PHP-FPM and it really isn't "a fair bit harder" to install or configure...

  • 0

Python.. django is just the easiest way to get going and even though there is a lot of php code out there, that doesn't mean its the best place to start. django is just so robust and easy to build robust applications with that i simply couldn't recommend php unless you specifically need to run an existing php code base.

  • 0

There's probably 10 times the PHP projects out there compared to Python projects, which is worth taking into consideration. Building something from the ground up, either works.

There are 10 times more PHP projects, but there are fewer Django (Python) developers. I get recruiters begging me for leads on Django developers pretty often because they are harder to find.

  • 0

What do you actually want ?

Do you want to have fun as an amateur ? Do you want to have a job one day as a web dev. Do you have a degree in computer science ?

If you are doing it to become a "pro" then you should start from scratch. Too many "web devs" these days don't master programming and are only good at using a framework. It's great cause it's easier for real programmers to find a job but anyway that's another subject ... Learn C and then get a proper oop book (one about the paradigm and not the languages). If you are already there then i suggest to learn how the web works before learning a language. If you know C and Java/C++/C# you'll have no problem getting into any languages out there. But CSS can be tricky. HTML too once you get into proper use of tags and things like WAI-ARIA. Javascript itself is easy but you need to know the DOM. I recommend learning Jquery too. After you kow how it all works you can start to learn a framework.

There's too much s***** web form dev out there knowing nothing about how the web works. It's daunting to see how much of these guys have a job when you get into a new org to help. Some of those guys can't even do a simple task in Javascript and CSS. And they can call themselves web devs go figure ...

If you do it purely for fun then try all languages and chose the one you prefer. Despite what a lot of people here will tell you there's no perfect language. They all have + and -. Ruby on rail is a good choice even if it's not used a lot. ASP.NET MVC is another good one. Php/Zend/... and even perl can be fun too from a programmer perspective. Stay away, very far away, from web form. Please do myself this favor. Personally when i want to have some fun i stay away from any framework and return to what dev used to be before people forget how to properly code because of frameworks (or maybe frameworks was created because too much people did not know how to code ;)).

  • 0

There are 10 times more PHP projects, but there are fewer Django (Python) developers. I get recruiters begging me for leads on Django developers pretty often because they are harder to find.

True. If I had to pick one to start out, with no need to do either, I'd go with Python. It's a better language, it's more useful in general, and I think it's going to grow from here out.

That said, if I wanted to pick up an existing system, or develop something for other people to use today, PHP.

  • 0

At the end of the day, php and python are both... ****. Python 2.x to 3.x broke almost everything for what reason? ABSOLUTELY NO REASON AT ALL!

PHP 5.4 removes safe mode completely and breaks PHP-GTK support and suhosain patch... WHY!? ABSOLUTELY NO REASON AT ALL!

Whichever you pick is equally as **** as the one you didn't pick, so it doesn't really matter.

  • 0

PHP can run very easily on all the major web server products out there, great documentation to learn with and follows a C++ like syntax. Due to the similarities/blatant copying of Perl functions, it's very fast to produce something quickly.

  • 0

Almost every web site uses HTML and Javascript, client-side. That's where I'd start. After that, server-side, there are many choices: Javascript is one again (Node.js), C# (ASP.NET), Ruby (RoR), Python (Django), PHP... Although I haven't learned it personally, PHP looks like one frighteningly bad language, so if you can avoid it, by all means, avoid it.

  • 0

PHP only runs in process with the server IF you are using Apache/Mod_PHP,,, otherwise you use PHP-FPM and it really isn't "a fair bit harder" to install or configure...

Yeah, I'm not entirely sure why I said it was hard, I actually have nginx+PHP-FPM setup on this very computer. And I'd say Apache+mod_php is a fairly common setup, every single web host I've ever used has done it that way.

  • 0

It's a bit of a tough call. Python is a good language, and infinitely better than PHP (faster too), but PHP is more common, so if you're looking for employability from your skillset, you're more likely to find work in PHP systems than Python systems (although both are pretty common).

Personally, I'd go the Python route. Be sure to check out ASP.NET (C#) and Ruby too, both nice languages and well supported for web development.

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

Last I checked Twitter uses Ruby on Rails for the UI and SCALA for the backend.

  • 0

my god so many people hate php .... I find it so useful :/

It's popular to hate on it. There's also a lot of terrible PHP information out there, which propagates bad code. I'm sure if you Google you can find a few thousand guides on how to create a username / password system in PHP that relies on storing information in plain text with out checking for SQL injections.

On the other hand, PHP's documentation is stellar, and it runs basically anywhere.

  • 0

Python Good:

Consistent, more respectable, better language overall and in practice. Teaches better ways to program almost purely by accident. usable outside of web development, decent documentation, excellent community. forced white spacing. Minimal 'boiler plating'. truly object oriented. Easy readability. "Google's language"

Python Bad:

Less documentation, less employable, can be argued that it's slower than PHP with some default configurations, my tests confirm this. Harder to implement on shared servers, even if its supported (which it isn't always). forced white spacing. Versions aren't backwards compatible from 3 to 2 (this can be a small or large issue)

PHP Good:

Huge documentation, easier to use for web development, widely supported, lives nicely side-by-side HTML, much more likely to get you a job, C style syntax is arguably more transferable. Can be very fast (hiphop). "Facebooks language (kind of)"

PHP Bad:

Huge documentation, reputation (which I think is not entirely PHP's fault), terribly inconsistent syntax and naming, many online tutorials teach you a bad way to do many things (which is where reputation gets ruined IMO), objects are a hack. Poor readability.

Overall: Although I'm almost primarily a Python developer, I usually use PHP for web development. It's fast, easy and gets the job done. It can be a little messy, and most 'code' that comes from it is hard to follow because it's all over the place. The choice is almost impossible for me, but I slightly recommend PHP. If you were to ever think about doing programming outside of web development I'd say to go with Python instead.

Hope this helps.

  • 0

I'd say PHP for quick developments and simple projects. If you're just generally looping through results from a database and doing very basic stuff I think it fits the bill. Read the article someone else mentioned about all the language inconsistencies though - the good thing is a quick google for what you are trying to achieve usually yields some results.

Although I've never used Python for web development, you will get the benefits of a cleaner more structured language, compiled code, proper object orientation and unit testing

  • 0

I'd dispute python being faster than PHP. Hiphop is by far the fastest PHP compiler/server, much faster than python, and out of all the world's largest/most visted sites, you've got google running whatever they use, MS using php and ASP.net, facebook using PHP, twitter using... jsp? I've yet to see a large scale site use python.

Perhaps my knowledge is out of date then. Last time I checked benchmarks, Python spanked PHP and ruby in speed tests, but checking the interwebs it seems that may no longer be true. Trouble with determining languages used for the web is that it's hard to tell who uses what. I'd assume that Google use a lot of Python though, since the benevolent dictator works there. I had heard that Youtube used it at one point too, although I don't know if it still does.

IIRC, Twitter used to use JSP, but they've moved to Ruby now. I'm keen to start learning RoR, I love Ruby as a language, and it seems to be gaining some serious momentum in web development.

  • 0

Read the article someone else mentioned about all the language inconsistencies though - the good thing is a quick google for what you are trying to achieve usually yields some results.

A good part of this article has be debunked. I'm too lazy to post link but do a simple google search. Anyone who write such a long blog post to critize a language clearly has an agenda. You know i hate web forms with a passion. I don't waste my time writing a 20 pages blog about it. I just don't use it when i can avoid it.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This whole dumb age verification thing needs to die and be replaced by giving parents tools to control devices. Why am I required to plaster my ID all over the internet to prove I'm old enough when parents should be the ones dictating what their kids are doing on their phones. Apple released great set of tools for iPhones coming to iOS 27 that do just that. Why are governments not mandating that kind of control to phone makers to built them into phones. This whole thing is so absolutely idiotic it's wild.
    • Remeber this decade, when the free internet died... tell your grand kids about this, record there reaction and post it on InstaTwitBook.com
    • UK nudity blockers are a looming privacy disaster, we must be able to see the source code by Paul Hill Image via Pexels The UK government, just like many state governments in the US and national governments around the world, has begun going on a bit of a power trip when it comes to digital safety. The major step taken so far is the introduction of the Online Safety Act, which requires users to prove their age to access adult websites (it includes more than this, too). Now, UK PM Keir Starmer is calling on Apple and Google, and presumably other mobile OS makers, to scan phones for explicit images to protect children. This potentially mandatory on-device scanning by vendor-controlled software will create unacceptable harms to individual freedoms and transparency, and introduce massive surveillance risks. In a statement on June 8, the Prime Minister stated that big tech companies, such as Apple and Google, must add features to their platforms, such as iOS and Android, that will detect and block sexually explicit or nude images involving under-18s on phones or tablets. Adults who want to take or send nudes would be required to hand over some form of identification to stop their phone from blocking these pictures, creating unnecessary privacy risks. According to the government, it wants to see these measures implemented within three months; otherwise, the government will introduce legislation to force them to introduce such technology. The legislation will include fines for companies and maybe even criminal liability for tech bosses who do not comply with the measures. In its announcement, the government said that stopping users from taking, sending, or receiving nudes without verifying their age is technically feasible, and pointed to a British firm called SafeToNet, which has made proprietary, closed-source, uninstallable software called HarmBlock and is actively selling a device with it enabled and is working with other OEMs. The fact that this software is closed source is a huge problem because it’s a black box; you do not know what it is doing on your device. The fact that it is unremovable is also a problem because you lose control of a phone that you own. Laughably, the government, just before highlighting SafeToNet, says that companies must introduce such measures “without threatening privacy or collecting any data.” It then says over-18s will still be able to view adult content by providing proof of age… Which sounds to me like data collection. SafeToNet makes some debatable claims about HarmBlock The government’s example software, HarmBlock, is a hugely alarming choice to espouse the virtues of this type of software. SafeToNet claims that HarmBlock is “ethically developed,” but this is the opposite of the truth. This black box software puts digital handcuffs on you if it’s installed in your device, taking away your freedom to control what software runs on your device, as it cannot be removed. It is not even free software, so we cannot inspect the source code to see what it is doing. For all we know, it could be acting maliciously. While that’s unlikely, we can’t verify that it’s not doing that. When Google and Apple do inevitably integrate these features on devices in the UK, they are very likely to be closed-source binaries, which will also be non-auditable. They will also have identity services built into them, which will require at least temporary collection of sensitive identity documents to verify your age. One saving grace for Android users is that this nudity blocker will very likely be implemented within the Google Play infrastructure that’s deeply tied into commercial Android devices. However, anyone with enough determination to throw out Google apps from their phone by flashing a custom ROM could find they regain control over their phone again without these digital handcuffs. Obviously, this is only how I expect Google to implement the feature; if it bakes it into the open-source Android somehow, that would be bad news for anyone looking to escape it. Outside of stripping mobile phone users of their freedom and sovereignty over their devices, these proprietary on-device machine learning or hash-matching solutions cannot be independently audited. This means that hackers could potentially exploit them because security researchers can’t investigate the code, and they could overstep their intended use case and collect even more user data without anybody knowing. We also wouldn’t know if the code is prone to detecting false positives or biased classification, because we can’t see the code. In the government’s announcement, contributing comments from the Internet Watch Foundation keep talking about “on-device protections” as if to say that users don’t need to worry about server-side processing; however, this is misleading, as data could flow from devices for the purpose of updates, remote model changes, telemetry, or server-side matching. We’ve also seen with the Online Safety Act that the government is never content with the laws it introduces; it always wants to expand the controls. If this scanning functionality arrives on devices, it might only block nudes initially, but later governments could pressure vendors for expanded access or use mandated features for other surveillance aims. The introduction of on-device scanners opens the door to massive risks in the future. Once nude blocking becomes normalized, regulators like Ofcom or politicians themselves could push for more controls over people’s devices. Very possible candidates for blocking include hate speech, misinformation, or undesirable political content. Also, there is a chance that once Apple and Google have developed this software, they might attempt to reuse the infrastructure for commercial or foreign requests, putting customers in greater danger. Just the UK's demand for this sets a precedent. What if a dictatorship decides to spy on activists by demanding that Google or Apple implement similar controls? Another concern with this scanning is that it adds compliance costs for businesses looking to get into the mobile operating system space. While Google and Apple dominate the space right now, there are lots of smaller companies creating mobile operating systems too, including community projects with very shallow pockets. How are these smaller competitors supposed to implement sophisticated nudity detectors? Simply put, they can’t. Then the government goes after them, causes them to shut down, and Google and Apple have less competition. Image via Aurora Store For us users who value sovereignty over our technology, this development will force us to seek freedom-respecting alternatives. The simplest path forward will likely be to install a custom ROM on an Android device; however, kicking Google off the phone with its black box nudity blocker could also make it harder to access apps such as banking apps, which tend to need you to pass Google's integrity checks. Thankfully, Google Play Store apps can still be obtained by storefronts such as the Aurora Store, but it just adds to the friction. To be fair to those pushing this measure to protect children, I think it will be reasonably effective, but people will still try to find ways around it, just as they’ve done with age gates on adult websites introduced under the Online Safety Act. In the effort to find circumvention methods, it could lead users to join riskier platforms that introduce new dangers. This effort also diverts resources from proven interventions such as law enforcement cooperation, targeted investigations, education, and support services to broad technical controls that have uncertain effectiveness (due to their newness). If the government is set on introducing such tools, then there ought to be safeguards in place. Any mandated code should be released as free software so that it can be audited, and the binaries should be reproducible builds so that the public knows nothing has been tampered with in the code used to create the binaries shipped out. Ideally, these tools should also be voluntary, opt-in, and even community-run. This would also allow people to have full control over their hardware while allowing parents to flip a switch to turn on these protections for children, with the knowledge that the code being run is doing exactly what it says on the tin, and nothing nefarious, like a black box solution could be doing. The government should also have a narrow legal scope where this technology stays with blocking nudes and not spreading to blocking political opinions, hate speech, and so on. Ideally, any implementation should avoid identity-linked age verification to keep user data safe, and matching should be done locally with no server telemetry to ensure it is truly on-device. While I do understand that stakeholders such as parents want to keep children safe, the potential for abuse with this type of software is colossal. It would entrench black-box surveillance and take away our freedom to use our devices as we want. There is also the acute risk that the government will demand this surveillance be expanded to block other activities, which could be particularly dangerous. If you are in the UK and don’t wish to see these measures implemented, it is still possible to write to your MP, which could lead to some better safeguards being introduced before it’s too late. Once we get more technical information about how this will be implemented, then we will be able to see if de-Googling Android devices will bypass this measure. For anyone with an iPhone, there is zero chance that you’ll be able to take off these handcuffs because Apple doesn’t let you mess with your software.
    • I'm reading the reports as EU rejecting Apple's proposal because Trusted System Agent would be an intermediary offered to third party AI's (this article is also worded as such) but Siri AI itself would not pass this intermediary. This would cause a situation where Siri AI would have more direct system access and offer it an unfair advantage. (speaking from EU regulator perspective here) Apple is citing security issues with doing what EU asked for, and I think this also supports this theory, because truly direct system access like Siri AI would make it impossible to control third party AI's running on the devices and e.g. reign them in via adjustments to Trusted System Agent. So, I _think_ this is the sticking point right now: EU saying they need to be on equal footing as Siri AI, Apple saying they can't be because Apple only trusts their own AI. Apple could of course be leaning a bit extra hard towards this because they're biased in terms of excluding competitors. One method to find an agreement would be to have Siri AI also run through Trusted System Agent and treat it as untrusted. This kind of defensive architecture design (especially when involving an AI) would honestly not be a very bad idea from a sheer engineering standpoint. But then Apple would need to swallow their pride and adapt worldwide due to EU, and make perhaps major updates delaying Siri AI once more.
  • Recent Achievements

    • Very Popular
      Captain_Eric earned a badge
      Very Popular
    • One Month Later
      amusc earned a badge
      One Month Later
    • One Month Later
      DJC50PLUS earned a badge
      One Month Later
    • Week One Done
      DJC50PLUS earned a badge
      Week One Done
    • Proficient
      Eric Biran went up a rank
      Proficient
  • Popular Contributors

    1. 1
      +primortal
      511
    2. 2
      PsYcHoKiLLa
      220
    3. 3
      ATLien_0
      92
    4. 4
      +Edouard
      90
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!