creating a real time application in laravel without nodejs - php

I am using a shared hosting in which i can't use node js.
But I want to create a real time application using laravel as per there https://laravel.com/docs/5.3/broadcasting doc they provide drivers they all uses node if I am not wrong.
I have also searched about https://github.com/Askedio/laravel-ratchet which works with laravel but it requires a ZMQ which I can't install on my shared hosting.
What should I do any ideas.

You could use Pusher and combine it with Laravel Echo. Echo is a front-end JS framework, so just include the assets and you should be fine.
I think it should be said that it's probably not a good idea to develop these kinds of apps on shared hosted servers, due to a couple of reasons:
You almost never have SSH access, so deploying and debugging is an immense pain
You can't install additional software you need, like NodeJS
Shared hosted servers often aren't build to run heavy php applications, they are build to serve simple websites (that's why they're so cheap)
Depending on your host, all other ports than 80 and 443 are closed, so usage of external services can be blocked
All in all, I think it's better to just get a cheap VPS (i.e. a DigitalOcean $10 plan) in which you can actually do all those things. Yes it's more expensive than shared hosting, but if that's really the game-changer, find a sponsor or partner. $120 is a piece of cake compared to the pains of using shared hosting, and that's speaking out of experience.

Related

NodeJS and PHP hosting

I am using nodejs and php on my website but when I want to host it on a server they told me there is no server that can run both node and php.
Is there anything that could take the place of nodejs and do the same work not requiring a server for it? I am using nodejs and socket to make realtime updates for my website .
A couple of options are DigitalOcean, AWS (Amazon Webservices) and Heroku.
Personally, I'd go with DigitalOcean. IMO it's the best for small projects; user friendly (good for beginners as well as advanced users), neat stability, easy scalability and best of all: insanely affordable. You can run both in one 'droplet' as you have full control over the OS.
You can do it at A2 Hosting
This allows Apache to act as a Proxy to the Node aplication,
A2 How to install and configure Node.js on managed hosting accounts

Web Hosting on Amazon AWS (PHP + MySQL)

I am totally confused on how to host a Dynamic website created using PHP and MySQL in Amazon Cloud.
I went through Amazon S3 and I hosted a static website there!
Then I tried Amazon EC2 and I learned some aspects about the concept of VPC. I thought that the dynamic websites are hosting in Amazon Cloud using EC2. I followed some steps and they taught me how to launch a website using Drupal (But, I didn't want that !! )
No other tutorials on EC2 to deploy my web application was not found.
Then I found AWS Elastic Beanstalk, I uploaded a simple PHP document and I can see that deployed successfully.
But Still, I am not satisfied. Because, I don't know which is the correct way to deploy my PHP application.
So can anyone direct me on Deploying a PHP MySQL Application in AWS ?
Depends on your needs. Elastic Beanstalk might be a good option for many apps, but I chose EC2 for my app's backend (using PHP, MySQL and S3 for storage).
Quick steps to get you up and running:
Log into the AWS Mangement Console and start a new EC instance (Windows server 2012 R2 Base > t2.micro should be good enough for a start!)
At step "6. Configure Security Group", add Rules for at least HTTP, HTTPS and RDP (so you can connnect via Remote Desktop)
Connect to your new instance via Remote Desktop and install a decent browser (Enable File Downloads in IE's Security Settings and download Chrome or Firefox)
Open the Windows Firewall and add rules for the same ports you opened in the Security Group of your Instance in the AWS Management Console. (Right-click on “Inbound Rules”, then select “New Rule…”)
Download and install XAMPP (I put it in C:\xampp)
Open the XAMPP Control panel and install Apache and MySQL as services (so they will start automatically when your instance launches); make sure everything is started up.
Now put your files in C:\xampp\htdocs\ and you're ready to go!
Bonus Steps:
Set up Filezilla FTP Server (and open the required ports in both the instance's security group and the Windows Firewall) so you can upload/download files without having to go through Remote Desktop.
Get an Elastic IP and assign it to your instance, so it's IP address will never change.
Get an SSL certificate so you can use HTTPS
The answer depends on the load that you are expecting and the resources you have to handle all the administration tasks.
If you expect heavy or variable loads, there are many reasons why not to deploy a production PHP + MySQL application on a EC2.
Here are some of the benefits of deploying to Elastic Beanstalk instead of a manual configured EC2:
You get version control of each deployment.
You can scale up or down automatically if you need more/less instances to handle new load.
You get a load-balancer in front of your EC2s instances with a bunch of out-of-the-box "recommended" configurations.
Regarding MySQL, if you go for an Amazon RDS instance you can handle replication, monitorization and automatic backups with pretty low effort. A lot of the configurations you would need to tweak are now available through parameter-groups.
On the other hand, if you want to have full control of everything that is going on on your server (that means you have time to monitor, backup and do maintenance tasks, which is not my case :), or if you do not plan to have much traffic, or if you want the less expensive option, you should go with a low cost EC2 instance.
In my experience, (after 2 years of working on AWS with 10 production applications, I'm kind of a regular AWS user) pretty much every customization or change I needed on both RDS and EBS I was able to tweak it and get it working, so I'm pretty satisfied with choosing the EBS+RDS option.
Below are two links i found which are helpful to Create and Update an Application with AWS Elastic Beanstalk
https://aws.amazon.com/getting-started/tutorials/launch-an-app/
https://aws.amazon.com/getting-started/tutorials/update-an-app/

is it possible for Wordpress Site to loading from 2 servers?

I have a WordPress platform based site, switched 3 hosting companies in 3 months, due to speed and uptime problem.
is it possible to host my site on two servers, if one is down site automatically run from second one :)
Note : 1). it is a design images based site (you can say wallpaper site)
Yes it's possible you can host your site on multiple servers with one domain by providing different 'Name Servers' e.g. ns1.domainname.com, ns2.domainname.com, ns1.diffdomainname.com and so on in your website hosting panel. This will serve your issue if your site is down from one server, it easily picks the site from other server.
The solution for this problem is setting up high available and auto scalable infrastructure.
You can use AWS, it supports everything you need.
Your WordPress application can be have 3 layers.
1) Load balancing Layer
2) PHP Application Layer
3) Data Base Layer
You can use elasticbeanstalk to easily installation and maintenance of Load balancing Layer i.e ELB and PHP Application Layer i.e ec2 servers
check out this doc for php application deployment using beanstack
make sure you are using multiple AZ(Availability Zone)s for in all layers to achieve high availability.
You can also use AWS RDS mysql or Aurora for DB layer
Yes! This technology is called "Load Balancing" for Servers, you could configure your servers with open source software, or you can do it with comercial companies that offers this.
You should do Load Balancing for each service that you need like: MySQL (or your database system) and Apache (or your webserver).
He an example: Setting Up A High-Availability Load Balancer (With Failover and Session Support) With HAProxy/Heartbeat On Debian Etch

Basic knowledge for Node.JS?

I'm trying to learn about node.js and there are tons of examples out there, but one question that I can't find an answer to or example is how does this work with web hosts (i'm using inmotionhosting.com)?
say I have a basic website www.url.com/index.php (note: I'm using PHP also). For this website to work, all I have to do is upload a file into my file manager in my web hosting site.
How does node.js work? do I just upload a node.js file into the web hosting also?
In all the examples, they are using localhost with port 8000 or something. Can someone shine some light?
Thanks!
you will need at least VPS hosting to install node.js, shared hosting won't allow you to install any application on your own, unless you they give you the option to do it.
then it all depends on how you have configured and what application is node.js serving, you can't really say where to upload files by default unless a path is set either from you or from webhosting..
from nodejs.org
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
it doesn't say it specific for web use, instead you should use a web framework such as
ExpressJS where you can build you web application or any other stuff.. your host should provide further information on how to manage packages in your nodejs instance, configuration, etc..
some usefull links
Domain API
ExpressJS
ExpressJS examples
Here is something i came cross.
Hosting your node app?
Hosting Node Apps
nodeFu
Supported hosting providers?
Node Hosting
just read the descriptions for each section.

NoSQL Solution for a Hosted Site

I'm operating on a hosted site without the option to install software packages (i.e.; unsupported binaries) and I'm interested in the benefits of NoSQL for a potentially database intensive site.
Are there any solutions of NoSQL that can easily be implemented with little-to-no sysadmin involvement?
Many of the NoSQL databases have hosted versions available.
MongoHQ is an example of one for MongoDB.
Have you thought about using 3rd party hosted DB solutions? For instance Google hosts their App Engine "platform" along with its Datastore. (http://code.google.com/appengine/)
As mentioned there are many hosted solutions that tend to be located on Rackspace Cloud Servers, or Amazon EC2 servers which you should be able to hook into. As a bonus many of them them (at least CouchDB and Mongo) eiher support natively or have extension that allow queries to be made over HTTP which should simplify connecting to them greatly. These hosted solutions manage 99% of the daily (and general) sysadmin faff so that you just worry about creating the database and reading and writing data to it.
(Just don't forget to allow your currents servers IP access to the hosted nosql DB when you wonder why it doesn't work)
CouchDB examples
http://cloudant.com/
http://www.iriscouch.com/
Mongo example
https://mongolab.com/home/

Categories