Reading laravel terminal output using Laragon - laravel

Actual state of art:
I need to expose my laravel app on internal lan, and sometime I need,or I close visual studio by mistake, so I moved the project on laragon, and everything is ok.
Need
During the test we have implemented some error_log() to debug some problems.
Problem
Actually I cannot read the printed error_log() or the http request, cause opening laragon terminal is like to be on the folder with the normal terminal, I cannot read the server running terminal.
What I want?
I would like to use laragon, and get access to the server instance console to read the logged data printed with error_log()

If you are running on Laragon just set your config to point to the public folder of your laravel. Give it the name of sitename.test or whatever. This will write a new line to your hosts file with the 127.0.0.1 IP. Then if you want others to view they will have to change their host file to
your computers ip addy sitename.test
Then open your firewall and let Laragon through on port 80 and port 3306 on your private network.

Related

Temporary server using current IP

I've got a XAMPP running on my computer and I've got dynamic IP.
However I would like to temporary change my computer to a server, using current IP, so someone from outside will be capable of entering my server.
How can I do it?
Right now if write down in the browser localhost it will open the appropriate page with my content, but if I write 127.0.0.1 or my current IP address, it's saying that "This webpage is not available". Why?

Homestead/Vagrant refusing Image manipulation

I am running into a problem with Homestead. I have a piece of code that works well on an online dev server, but fails in the vagrant Homestead one.
The piece of code is an ajax executed one, where I upload an image, save it in a temp directory and send it back to the user, who then crops it. For this, I have two functions, tempUpload and tempCrop. It is failing in tempCrop, and most the line that triggers it is the following:
$img = getimagesize($imgUrl);
$imgUrl is an input with the url to an image in a temp folder. Checking in vagrant, I saw that these images have attributes -rwxrwxrwx 1 vagrant vagrant. The error appearing in the console is "SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data".
Again, this works perfect in an online version, so I guess it is either a permission problem or some environment setting. The permissions for the temp folder in vagrant are as following: drwxrwxrwx 1 vagrant vagrant
I have checked in /app/storage/logs, and the error I'm getting is:
'getimagesize(http://nominate.app:8000/temp/2078ec37e959dd733930ad758854ce4cb5f175de.jpg): failed to open stream: Connection refused'
I really don't know what else to look into, specially since it is working fine in another dev environment I have, running centOS.
Any ideas?
Thanks a lot.
The answer would be to put the path rather than the url into getimagesize.
Basically, as far as your virtual machine knows, it's serving on port 80. Vagrant seamlessly forwards this port to the host machine's port 8000. When you call getimagesize, it first tries to resolve the hostname (nominate.app), and, if successful, it tries to initiate a connection to it on port 8000. I'm guessing that nominate.app is configured to resolve to 127.0.0.1 (the VM), which isn't actually listening on port 8000.
It's a bad idea to perform those sorts of operations over HTTP, since it'll slow things down and potentially generate multiple temporary copies of the same image. You can use Laravel's path helpers to help you determine the local path of the image (i.e. getimagesize(public_path() . "/temp/" . $filename)).
Changing my host file to point homestead.app to the Homestead VM's IP of 192.168.10.10 rather than 127.0.0.1 resolved this very same issue. Additionally, I can now navigate to http://homestead.app rather than http://homestead.app:8000.
Thanks to ClarkF for pointing me in the right direction to get this resolved!
As much as we don't enjoy "it works in develop but not in production", it's even more curious when it works in production but not in develop!

How to access vhosts via IPad?

I'm using XAMPP, on Mavericks, to simulate a localhost. I set jobeet.local, for example, as my vhosts. I tried to access it on my computer, it worked as well.
Now, I want to test my website on an IPad. So, I did the following steps:
Run XAMPP server on port 80, as usual
Connect the IPad to my wifi network.
Setup Http Proxy on Ipad, as picture showed below but change the port to 80
Now, I tested to access 127.0.0.1 via IPad. It worked! However, jobeet.local doesn't work.
I have searched and tried many ways to achieve this issue but they don't work.
Could you help me figure it out?
Thanks in advance.
You might have to update the hosts file.
The hosts file is a text file that maps hostnames to IP addresses.
Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers.
The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Editing the hosts file
Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.
Step 1 – Open the Terminal.app
Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
Step 2 – Open the hosts file
Open the hosts by typing on the Terminal that you have just opened:
$ sudo nano /private/etc/hosts
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).
Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
You can navigate the file using the arrow keys.
Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
$ dscacheutil -flushcache
You can now test your new mapping on the browser!
Hope this works for you!
I had to reinstall my setup today and made a step by step at that occasion:
I use a combination of Squidman and Mamp Pro (I assume it's similar to XAMPP)—hope this help anyone in their quest; happy to read feedback or get advice to make this better...
Squidman http://squidman.net/squidman/index.html
Mamp Pro http://www.mamp.info/en/mamp-pro/
on Squidman
- Preferences > General > Http port:
something different from the one MAMP is using (if map uses 80, then put 8080)
Preferences > Clients > Provide proxy service for:
insert the IP address or the subnet we will be catering for
Start Squidman
on MAMP:
setup the hostname, as well as the the website attached
insert the (local) IP address of the local machine
insert the port of Apache on the local machine
start Mamp; check that website is running correctly on local machine
on iPad/iPhone/mobile device
select the same wireless network as the laptop
in Wifi network > Preferences/Information: set a Manual HTTP Proxy
server IP is the (local) IP address of the Apache server, also running Squidman; port is the port used for Squidman
(Extra)
stuff to test: move dev server onto virtual machine (VirtualBox), to use with Node, custom PHP build, etc.
automate the setting: write pref for Squidman, Mamp/hostname, restart the Apache server, send configuration of proxy to mobile via iMessage or email.
I recommend using http://xip.io/. For example (taken from the website):
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
It does the job and you don't have to set anything up. I'm only pushing it because I am overly excited that I have wasted time trying over-engineered solutions.
On a mac you can use Squid on Windows that's Fiddler, however I'm having troubles with Fiddler and iPhone at the moment...

Can't access XAMPP from other computers

I have installed xampp on my windows7(64bit). I can view my php website from my own computer but others within the same network can't open no matter they tried my own IP 192.168.x.xx/web folder or 127.0.0.1/web folder.
I did the same thing before in the 32bit win7 and it worked fine. I wonder how I can get it work?
I am pretty new to php and xampp so please give more detail. Really appreciate it!
If you are using windows than all you have to do is to go to Allow an app through Windows Firewall.click on Allow another app select Apache and mark public and private both .Again Allow another app this time select xampp and mark both public and private and is done click apply and exit .
Open cmd by pressing windows button+r write cmd than in cmd write ipconfig find out your ip . than open up your browser write down your ip http://192.168.1.x and you will be on the xampp startup page.if you want to access your local site simply put / infront of your ip e.g http://192.168.1.x/yousite.
Now you are able to access your website in private network computers .
Try running this command and verify that your web server port is listening on all interfaces (0.0.0.0):
netstat -an | find "LISTEN"
It is really common for Tomcat to not listen on 0.0.0.0 until you specifically configure it to do so.
Other than that, verify the port is not being blocked by something.
127.0.0.1 definitely wont work as that is the ip address of the local machine.
Are you perhaps missing a port number in your url, so from another computer try 192.168.x.x:80/index.html or similar
May be your firewall configuration is on, change it, your issue will resolve. I too have the same issue and resolved it through this way.
Change Your Firewall Setting. It would be on So Please off window firewall Setting. I hope so it will be work.

localhost host not working on XAMPP

I am facing same problem to the thread. I've gone through all the suggestions provided in the solution. I've searched all possible solution but nothing gonna workout.
"http://stackoverflow.com/questions/817745/localhost-not-working-on-xampp-both-service-apache-mysql-are-fine"
I've ensured :
1. Xampp is successfully started (in log) but it is not receiving any request(checked access.log).
also ensured that it is running on port 80 in config file.
confirmed status of application using netstat
C:\Documents and Settings\user>netstat -aon | grep 80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 3524
Checked host file in /windows/system32/drivers/etc/hosts and has only one entry
127.0.0.1 localhost
skype teamviewer or other application are closed and configured not to use port 80.
ensured that windows firewall allows http process to use port 80.
pinged localhost, 127.0.0.1 and my ip (192.168.1.2). localhost resolves to 127.0.0.1
tried different urls http:// localhost http:// localhost:80 http:// 127.0.0.1 http:// laptop-name but nothing works. browser just waits for response (spaces after http to allow links in this post)
ensured that there is no loop in index.php(it is untouched) and also has index.html. also tried diffent paths
nothing gonnna work out. I am irritated and I dont want to format my machine. please help....
when this happens to me it is usually Skype taking over the default localhost address
Check on command prompt
netstat -a -b
And close any other application like skype etc using 80 port.
Try stopping IIS. It worked for me.
Select Start, then type IIS in the search box
select Internet Information Services Manager
In the manager on the right under "Manage server"select "stop"
I was having an issue with Last.fm that is very similar to yours, and I found that it was a software conflict.
The Last FM scrobbler application would not finish installing on my new build because it couldn't login or authenticate my username. I tried the regular scrobbler application and then tried the beta desktop program on Windows 7 64 bit. I suspected Skype or TeamViewer, but even after stopping or exiting those programs, neither versions of the installation would log in to the services.
The beta desktop application actually authenticated on 127.0.0.1 (random port) through my internet browser, but my browser would time out trying to send data over the port.
I checked and edited my HOSTS file in Windows, but that didn't fix the issue either.
Pinging 127.0.0.1 worked, but pinging any variation of the port would time out.
Finally, I decided to uninstall the Windows 7 Firewall Control program made by Sphinx Software. Mind you, I had set the firewall to be disabled at start up (clean start-up - all startup programs disabled through MSConfig).
I made sure that the firewall program was not running at all in my services. However, after uninstalling the software, even without restarting my computer, 127.0.0.1 opened up on all ports and my Last.fm scrobbler finally connected and finished installation.
So, it may be a hidden setting that can only be undone by uninstalling programs (even programs that aren't running).
For me localhost was not the correct address.
Type into cmd "hostname" and use that as the url.
CMD -> hostname
If that doesn't work try just the ip address of the server (or computer)
I stored my website folder in xamp/htdocs (windows machine). Then I started apache on the XAMP control panel. My pages rendered successfully when I called http://localhost/mysite/index.html.
I hope this is helpful.

Resources