Cannot Get Laravel Welcome Page to Show - php

My server is on DigitalOcean cloud. I am using Ubuntu with Apache web server. My home computer is running Windows 7. I am using putty for terminal.
Followed all of the directions on https://laracasts.com/series/laravel-5-fundamentals/episodes/1. Made it up to 8:40, where it directs you to run php -S localhost:8888 -t public. I run that, then open a web browser and tried the following:
-http://mywebsite.com:8888
-http://www.mywebsite.com:8888
-http://mywebsite.com/learning-laravel-5/public
-http://mywebsite.com/learning-laravel-5/public/index.php
None of the above work.
In Google Chrome, the first two options where I list the port number, I get a page saying This webpage is not available. ERR_CONNECTION_REFUSED. In IE, I just get a page with big font saying "This page can't be displayed."
For the last two options, I just get a completely blank page. In the console, I get this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error).
I'm trying to pick up a web app framework to broaden my php skill set. Can someone help me out? What am I doing wrong/what is the video tutorial missing that I have to do in order to get Laravel up and running?

php -S localhost:8888 -t public is meant for running a site locally, which is what the video is showing.
If you are using a Digital Ocean droplet with Ubuntu and Apache, you will need to configure Apache to use /public as the document root and have Laravel installed in the /var/www directory.
From there you can visit the droplet's IP address (http://XXX.XXX.XXX.XXX) instead of the domain name (unless you have configured the DNS for that domain name). You won't need the port in the URL either, since Apache will be serving it on the default port 80.

This probably is not the answer you want, but here's my advice based on setting up a few VPSs on Digital Ocean. Step back. Spin a new VPS. Keep your old one around, if you want, but start afresh.
Create a new droplet
Setup your SSH and PuTTY and make sure that works
Setup your FTP (if you're using it)
Setup your DNS
Setup your Apache config files. DO has a very good tutorial on this: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
Now, work on getting your "Hello world" html page to show when you access your domain www.yourdomain.com, yourdomian.com. Don't fixate on ports at this point, just get a minimal server running. This might help too: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
Make an saved "image" of this basic working setup so you can spin a new VPS if you need to.
Now that you have a server that loads your domain index page, you can start to install your Laravel.
In a nutshell, I'd advise you to establish a stable working server platform before you try to install and launch a more complex technology like Laravel, or Rails, etc.
Tutorials often make complex technologies seem easy, the 10-minute expert, but there is tremendous complexity masked under the hood of these frameworks. Start simple and build on a server one piece at a time. You have to walk before you run.

I use Laravel often, but my experience with servers is more relevant here. Everything you've said indicates an access problem, and knowing how hosting companies work, they probably have that port blocked (along with all other non-standard ports).
You can test this using PuTTY, open it up and enter the host name of your server. Change the port to 80 and change close on window exit to never, then connect. Enter:
GET / HTTP/1.1
Host: yourwebsite.com
Then press enter twice and the server will process the result. It should show you the HTML of your home page.
Now try it again with port 8888 and see if you can even connect. If you can connect then it's not a port issue, but my guess is you'll get a fatal error Network error: Connection refused, which means the port is closed or blocked via firewall.
Even though DigitalOcean give you complete control over the server, the connection probably still runs through their firewall. It's possible that you have your own firewall, but otherwise if the server runs through their firewall and the port is blocked nothing you can do on the server will open that port.

did you try chmod -R 0777 storage ?

Related

how to rewrite -host-header in ngrok in order to open a sub-website in xampp running on localhost

I am trying to expose my website to internet, using ngrok, my website lives in xampp server which is running on my local machine. the path to my website is this: C:\xampp\htdocs\TheWebsite
when i use the following command for running ngrok client:
ngrok http -host-header=rewrite TheWebsite:8081
the client gets connected to ngrok server, but when i try to access my website on internet using http://234k2h4k24.ngrok.io which is the url ngrok provides for me, i end up with this error:
The connection to http://234k2h4k24.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address TheWebsite:8081.
Make sure that a web service is running on TheWebsite:8081 and that it is a valid address.
The error encountered was: dial tcp: lookup TheWebsite: no such host
how exactly one should set the value for -host-header switch in order to to get the sub-directories (websites) living in htdocs folder in xampp server environment??
I have searched this site and also all over the Internet and i found some quick answers but they confused me even more. like this one:
https://helgesverre.com/blog/expose-local-webserver/
which doesn't even provide a small example
and this: Tunnel a localhost subdirectory through ngrok?
just the same as previous one (no example)
A real good answer needs to provide at least one complete example (i mean, if you want to answer this question, please provide a full example of ngrok command for the path of my website (TheWebsite). thank you
for this purpose i needed to define virtual hosts for each of my websites!
I found the answer in a related question at stackoverflow.com and here it is:
Tunnel a localhost subdirectory through ngrok?
this question leads you to this page which lets you know how to define virtual hosts in order for your local machine to identify where is the requested website, just take a look and you will learn in it no time. here is the page:
http://forum.wampserver.com/read.php?2,127757
although its for wamp but it is the same for xampp server too!

php built in webserver not reacheable with ip:port via network cable

I have been trying to make things work for a while now but I did not succeed. I also have done a lot of research, in vain. I really hope that someone is able to help me find the root cause of that issue:
I am trying to connect to my localhost:8000 from another computer (which actually is an arduino ethernet but that doesn't make a difference I guess) by using an ip address. I set the ip address manually in network settings (192.168.1.5).
funny enough, the connection from the external device to 192.168.1.5:80 (which is the normal apache server) works, hence the problem cannot be IP-based.
However, the connection to the php built in webserver running on localhost:8000 does not work. I am trying to access it with '192.168.1.5:8000' obviously - I guess this can not be the mistake?
Now I am wondering what the cause of the problem is. Is anything preventing the connection to port 8000 or does the php built in webserver not respond to the manually given ip? Why does the apache respond to that IP though?
Thanks so much for any hint!!
Steffen
The built in server is, by default, only available on localhost. You have to provide a address wildcard mask, if you want to access it over the local network.
$ php -S 0.0.0.0:8000
However, please be aware of the security implications. If your machine is connected to the internet directly, automatic port scanners will find it sooner or later and may take advantage of security problems.
An address mask of 0.255.255.255 will do fine for 10...* networks, and 0.0.255.255 will do fine for 192.168.. networks.

Want To Turn Off Drupal App So I can Run Meteor App In server

I am not familiar with drupal or php. I had some developers do my website and they installed it on my digital ocean server.
However I learned how to code and redid the site to my liking, using meteor instead.
I am using 'mup' to deploy the app, and I already did this in a test domain, so it works fine. The problem is that in my real domain, I have the drupal app running, and I don't know how to turn it off.
If it was meteor I could do something like 'mup stop' and it would terminate the process on port 80. But I have been looking how to do this with drupal and the LAMP stack but I don't know how to do it.
IMPORTANT: I have an existing database that I will need in the future from the drupal app, so reseting the server is not really an option. I just want to stop it from running.
This worked! Killed the process running on port 80 and my site was working!
sudo kill `sudo lsof -t -i:80`
Drupal is not an app it's a website. If you want to stop the drupal website then stop apache server with command "service apache2 stop" or any equivalent command which stops your web server only.
Or else you can remove pointing your domain to the particular ip address where drupal website is hosted so that your website will not open in that domain.
Thanks

Run PHP code on local MacOS Jekyll site, port 4000

I've build a Jekyll website on my localhost (MacOS Mavericks). The website is served at http://localhost:4000/website/ and everything regarding Jekyll is running just fine.
However, I now want to have a contact form in PHP that allows me to receive emails. I placed a contact.php file in the website/ folder and have the form POST to that file. On my remote web server, this is working perfectly. However, on the localhost, the PHP isn't parsed, and plain text is displayed on contact.php. However, PHP is parsed perfectly on localhost/contact.php.
How do I get my localhost (Apache? PHP?) to process PHP files on my local Mac http://localhost:4000/ (without breaking my Jekyll website that listens on the same :4000 port)?
You can't use the same port. The port determines the application endpoint that will handle the request on the IP address. The Jekyll server (WEBrick library) uses port 4000 as a default.
The typical way to handle this problem, is to use a "web service" to add dynamic functionality. For instance, the jekyll docs suggest using something like FormKeep, or SimpleForm.
What you're asking is to setup a "web service" yourself. To do this it would need to be on another port or another IP address. The "service" will simply act as an endpoint to accept and process your form post. In this case you could setup a webserver using Apache/PHP on a different port than Jekyll -- such as the standard port 80 -- then write a PHP script (e.g., webform.php) that in combination with the static form is setup to respond and process your form.
Note: It is possible to configure both Jekyll and Apache to respond to requests on port 4000. However, both applications (aka servers) can't be running at the same time. The ip:port combination determines which application an internet request is sent to.
I realize the post is old but this may help someone...
The answer by Mike Stewart is excellent and describes what needs to be done to accomplish the goal.
To add to that answer, here are the specifics of how I do this type of development on a Mac.
Configure CORS in Apache
Run the Jekyll site on default port 4000
Run MAMP stack on default port 8888
Code goes in MAMP's htdocs folder (htdocs/your_project)
PHP resides in a separete "php" or other folder inside the "your_project" folder
Jekyll watches the "your_project" folder and compiles to _site as normal
The CORS issues you'll experience can be resolved locally during development several ways. Here is a good resource for enabling CORS on Apache: http://enable-cors.org/server_apache.html
Once you have CORS configured you'll be able to make Ajax calls to the PHP on port 8888.
I'm running the PHP built-in web server alongside the Jekyll server. I opened a second Terminal window and navigated to the _site folder. The command is php -S localhost:8000 (or whatever port you want to use that is not 4000).
Note that I'm using viewing localhost:8000 in the browser, but having the Jekyll server running simultaneously is nice because Jekyll keeps the build updated as I make changes to the source code (refresh required).

How to access PHP files using HTTP over peer-to-peer network?

I connected two PCs (say PC1 and PC2) using a patch cable (Category 5E) while both of them run on Windows 7. The IP addresses for PC1 and PC2 are 192.168.1.2 and 192.168.1.3, respectively. I've successfully configured a homegroup for the two computers and there was no problem in simple file sharings.
What I should know is that, having installed WAMPServer and stored some PHP files in PC1's root directory, how could I access them from PC2? I tried typing 'http://192.168.1.2/aphpfile.php' in the PC2's browser. And, I got no expected result. The browser simply said that it could not access the page. I'm not an expert in networking. Please help me.
PS: Please, don't close this question as a duplication. I searched related questions in this site but nothing was found helpful to me.
By default, WAMP assumes you're developing locally and will not answer requests made from outside the machine. You have to click "put online" from the WAMP menu. It will configure Apache to start listening for incoming connections from outside your machine.

Categories