Home » Php » mysql – Using meteor.js with php server side

mysql – Using meteor.js with php server side

Posted by: admin July 12, 2020 Leave a comment


I’ve developed an application that I would like to use meteor.js for real time updates (I want to enhance but not change my program, for example when a user adds a comments make it update in real-time ) . Problem is meteor.js uses node.js (so javascript as server-side code). I use LAMP stack, Is it possible to get PHP to feed data into meteor.js from mysql.

How to&Answers:

Meteor is more than just an ‘interactive webapplication’-builder or javascript framework. The idea is to have only one programming language (besides HTML/CSS for markup) to do all the work. Basically it creates a ‘remote server’ (in the clients browser) it can push data to and at the same time it publishes various API’s to the users system. The data passed through these API’s / connections has a specific structure which has to be adhered at all time.

Meteor is built around NodeJS, which makes it hard (if not impossible) to run it without this backend. Sure you can try to mimic the backend using PHP, but it would be a waste of time. Reading your question you’ll be better of using a javascript framework like jQuery or Prototype. Unlike Meteor you will need to do the AJAX calls (POST & CallBack) yourself, but you can actually decide which backend you want to use yourself (including PHP / MySQL).

If you want to do this anyway you need to check the Meteor & NodeJS source code to see what the minimum requirements are to make Meteor run under PHP. The PHP stack has to interpret the commands Meteor sends and receivers, but this won’t be an easy task.


You can use comet (or reverse ajax) for realtime updates.


Trying to marry node.js with PHP doesn’t sound like a worthwhile path to go down. If someone insisted on using a system like Meteor.js, yet with a PHP back-end, it would make more sense to look at AngularJS which is mainly the client side.

Of course, that is different technology stack. If someone really insisted on the blending, one could consider using server side sockets to interact with PHP Web services; and/or use mongodb and/or mysql-node to interact with the same databases.


I released a meteorite package that interacts with a WordPress site that has the WordPress JSON API. A quick fix. For now.

Comes with a backend call that will return the raw data, or a publication that stores the posts using their id’s instead of a randomly generated mongoid. And some basic templates to get you started including a Session variable that keeps track of the currently selected post.

I’m working on it a lot more and will eventually have a version that directly makes mysql calls from node so you won’t need php or WordPress; just the ability to access the mysql database (which can be remote, with the appropriate configuration, or on the same machine).