20i Reseller Hosting

PHP/MySQL, NodeJS/Mongo DB, include header w/o PHP

Discussion in 'Scripts and Coding' started by woopwoop, Aug 5, 2018.

  1. woopwoop United States

    woopwoop Well-Known Member

    Joined:
    Jan 2007
    Posts:
    2,212
    Likes Received:
    37
    I'm looking for a bit of help. Many of my websites have been on Wordpress and so experimenting with PHP and MySQL has been a part of my education.

    I'm in a situation where I'm building a website with the following features:
    • Member sign in / register
    • Members can list items (similar to classifieds) with many fields (including images, geo location)
    • Google Maps showing location of items (based on ZIP/location)
    • The website/database will also be the backbone for an app.
    • Alerts, likes, push notifications
    • Ad control panel where businesses can pay for listings

    I'm tempted to struggle my way through this with PHP and MySQL but after starting an online Udemy course they're strongly recommend avoiding it in favor of newer languages. They recommend NodeJS and MongoDB.

    Can anyone shed some light into these as alternatives and why to drop PHP/MySQL - and is MongoDB something that can easily be set up in a cpanel?

    As I'm putting the pages together I realize that I'm even lost with how to include the header and footer without php - any advice on what's the most efficient? Should these types of includes be server side?

    Thanks for any help.
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    2,082
    Likes Received:
    236
    The only thing you would need Node for in your whole list is the push alerts. This is a common 'buzzword' it seems for developers at the moment but to me it's like recommending a hammer to swat a fly. It *will* work but there are easier and faster ways of doing it. Node is an inefficient way of serving normal webpages and, without a buggy plugin, you can't inject php created code into those served pages. It excels where you need to have a constant connection for two way interaction with a client such as the live chat I put on one of my sites (an even then it is really just a wrapper around socket io). However php and mysql are the way to do what you want and then you can add a little bit of node for that section later on. If you create a standalone app you can always have the app interface with node, node call the pages so they are created outside of node, and then serve them to your client. ie it doesn't have to be used for actual generation - just as a middle man with a constant connection.
     
    • Like Like x 1
    • Informative Informative x 1
    Last edited: Aug 5, 2018
  4. Skinner

    Skinner Well-Known Member

    Joined:
    Jul 2008
    Posts:
    4,611
    Likes Received:
    129
    I've been hearing this tosh too for years, use .net, Ruby, c#, Swift, Go, not to mention use PHPNuke or Joomla or blah, in the end the only constant has been PHP, MySQL and use other tools as and when needed.
     
    • Like Like x 1
  5. JMI

    JMI Active Member Acorn Supporter

    Joined:
    Oct 2015
    Posts:
    176
    Likes Received:
    34
    I would hardly say C# and SQL Server is tosh MySQL and php + WP while established is a bit old hat now. Although some of the biggest sites did and still do use php and there are plenty of free resources out there and being free make php popular, but , c# being compiled + sql server is a far more powerful and scalable solution for when your site grows - I would consider pushing yourself. JS not worth learning to any extent. It's all going back server-side now anyway.
     
    • Like Like x 1
  6. woopwoop United States

    woopwoop Well-Known Member

    Joined:
    Jan 2007
    Posts:
    2,212
    Likes Received:
    37
    Thanks for all the input - I'm still confused!

    Tough when a Udemy course is telling me to give up on php and use another language - the teacher is pretty interesting and I can buy into a lot of what he's saying - but maybe sticking with php and continuing to learn it is stretching myself.

    Although I've "made things work" for a long time as a badly self-taught hobbyist, I'm still at the point of html=nouns, javascript=verbs, css=adjectives and as I start to learn js I think I have to continue with that to understand the basics more deeply too.

    Thanks again.
     
  7. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    2,082
    Likes Received:
    236
    html and javascript (ignoring node) are client side - that means they are delivered to the browser and interpreted using the *visitor* machine.
    php is server side - that means regardless of browser/os the visitor has no control over that php can produce.

    A good example is one that came up earlier in one of my threads. Date. If I used javascript to show you the current date and time it would use *your* local settings as it's on your machine. example 3am CET in Europe and 2am BST in UK. However if the date was produced by php just before you saw the page it would be shown as the server date - ie nothing you or your settings have any control over. Now combined with access to a database, usually mysql, a server can create relevant data and perform calculations *before* create a page which will then be served to you. It is also faster and gives the advantage of only having to work correctly with one infrastructure.
    This is good enough for most websites. You don't need constant interaction between the server and client - the client tells the server what it wants to see and the server creates it and serves a finished page to be viewed by the client.
    Then along came node js - this was simply a way of running javascript (known by many and easy to grasp) on the server side instead of relying on the client machine to run it. However, in my opinion, this is buggy and FAR too bloated - it is just a lazy way of wrapping an easy language around more complicated inherent structures. Having said that it is very easy to keep an open communication between client and server, and instead of waiting for the client to request information, send information when you want.

    If all of that does what you need (and it probably will as other languages only offer a different syntax) then all you are after for a functioning and detailed website is php, mysql, html, css, javascript, (and maybe node).

    Anything else is just a different wrapper. Last century I was programming with Assembly, Cobol, Pascal and C. Then along came c++, c# and a plethora of other languages,perl,python,php etc. The point is they usually have a common theme but different uses and utility depending on the task needed and the age of the language is totally irrelevant. One is not better than the other but all differ slightly in syntax and largely in structured mentality. I can smash a walnut with a 10 ton weight. I can also use a nutcracker. Both do the task but one is harder and more unwieldly than the other for the same task. That doesn't mean one is useless and another isn't as both *can* fulfil the task - just that one is more suited and that is the case with what I've written above. Now some people will tell you only to use a 10 ton weight because maybe they don't have a nutcracker, they don't understand how nutrackers work, or they think people using a nutcracker are 'below' them. This sounds to me like the Udemy course :p Also always bear in mind that people who have been taught programming are usually not great programmers or advice givers - they cannot think or approach a problem differently to the way they've been taught ;)

    Just one more thing - if they're advising you to forgo php and mysql for node then clearly they don't know the difference. None of those do the same as the others and they should be used *together* to complement and cover all angles. It's like me saying don't wear gloves if you're going to wear socks.
     
    • Like Like x 1
    Last edited: Aug 11, 2018
  8. JMI

    JMI Active Member Acorn Supporter

    Joined:
    Oct 2015
    Posts:
    176
    Likes Received:
    34
    I would say stick with php, css and mysql for a bit until you are quite comfortable, the general knowledge will be transferable to other languages/ rdbms.