Not found error on setting up local server using LAMPP - lampp

When I enter localhost/hello.php in my browser, I get below error.
Not Found
The requested URL /hello.php was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80

I think there is some compatibility issue in the LAMPP and Ubuntu.
To start apache2 normally you need to first hard stop it through following command:
Sudo service apache2 stop.
And then restart the apache2 or LAMPP . This worked for me.

Related

Valet 502 Bad Gateway

valet is not working after I updated php from 7.3 to 7.4. I already tried to reinstall valet, php, nginx and dnsmasq but it's still not working.
Now the ngix server is running but I can't acces to my projects. I get the error 502 Bad Gateway for every project url.
The services are running but brew services dont show the correct status.
dnsmasq unknown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
gitlab-runner started user /Users/user/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist
mysql#5.7 started user /Users/user/Library/LaunchAgents/homebrew.mxcl.mysql#5.7.plist
nginx unknown root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php error root /Library/LaunchDaemons/homebrew.mxcl.php.plist
php#7.4 unknown root /Library/LaunchDaemons/homebrew.mxcl.php#7.4.plist
redis started user /Users/user/Library/LaunchAgents/homebrew.mxcl.redis.plist
Nginx error log
2021/01/27 16:35:21 [crit] 35081#0: *1 connect() to unix:/Users/user/.config/valet/valet.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/Users/user/.config/valet/valet.sock:", host: "devtest.test", referrer: "http://devtest.test/"
I've managed to get mine working again.
I started by doing a full wipe down following the instructions that valet gives when you run valet uninstall which involved removing valet and all associated config, uninstalling php, nginx and dnsmasq via brew and cleaning up all remaining config. I then reinstalled everything, reconfigured my sites in valet and tried to load one up. Still I got the 502 Bad Gateway error.
I eventually tried running valet use php to make sure it was correctly bound to the right php version. Valet claimed that is was but I ran it again with the force flag just in case valet use php --force.
After that I was up and running again. Hopefully this might help you too.
What's strange is that my brew services list output lists dnsmasq, nginx and php as status unknown but they do all seem to be running correctly. I can't work out what's happening there but at least everything seems to be working again now.

#2002 - Connection refused — The server is not responding (or the local server's socket is not correctly configured)

My phpmyadmin showing this error, I am working on Ubuntu OS:
2002 - Connection refused — The server is not responding (or the local server's socket is not correctly configured)
mysqli_real_connect(): (HY000/2002): Connection refused
Connection for controluser as defined in your configuration failed
mysqli_real_connect(): (HY000/2002): Connection refused
This problem is occurred on Ubuntu, I tried all previous stack overflow answers, but it doesn't work for me.
I faced that similar problem using lamp , check if you may have more than two mysql path like in
Find all the other mysql installed in your system
`whereis mysql`
`mysql: /opt/lampp/bin/mysql /opt/lampp/bin/mysql.server /usr/share/man/man1/mysql.1.gz`
Now if in you're system two mysql if overlapping then remove others and keep only one mysql installed by lamp
sudo rm -rf /etc/mysql
Here is the link i found for apache2 i did the same with mysql and it's working
http://xmodulo.com/how-to-uninstall-and-remove-apache2-on-ubuntu-debian.html
Finally stop all the mysql existing service running
sudo service mysql stop
sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start

Mac docker unable to access port 80 with nginx

I'm following the tutorial "Getting started with Docker for Mac" but I'm unable to access the nginx home page at localhost. Every time I access localhost, the displayed page is "It works!" which is the default page contained in /Library/WebServer/Documents/index.html.en. I tried to kill all httpd services to remove the binding to the port 80 but it didn't change anything. I also checked that there wasn't any application that was running on port 80 and that neither Skype, MAMP or an Apache server who could be using this port was running.
I think that my Docker installation is correct as I'm able to run the docker --version, docker-machine --version and docker-compose --version without error. I'm running the container with the command described in the tutorial
docker run -d -p 80:80 --name webserver nginx but it doesn't work. I tried many ports but it didn't change anything.
Here is the output of a
docker ps
So I tried to access the app via 0.0.0.0:80 but it didn't work neither, it always redirect me to the page contained in Library/WebServer/Documents/index.html.en. I tried binding to all kind of ports (8080:80, 8181:81, 8181:80, 8181:8181 ...) and nothing never changed. In those case, I got a page telling me
"Safari can't connect to server. Safari can't open the page "0.0.0.0:8080" because Safari can't connect to server "0.0.0.0".
I also tried replacing localhost by 127.0.0.1 but I still have the issue.
If you need further explanations or have any question, ask me. Thanks in advance for your help

Unable to connect to Apache server over HTTPS on Centos7 on VirtualBox from MAC

I have a Centos 7 OS configured on VirtualBox machine. I have installed X509 certificate using Openssl tool and configured the apache HTTPD server.
I connect to Centos7 guest on VirtualBox via SSH on my local MAC OSX Seirra (10.12.3) on terminal using root. I have verified that /etc/host on my MAC is correctly pointing to the guest on VirtualBox. Also verified the port forwarding on VirtualBox and they are all setup correctly for allowing traffic on 80 (http) and 443 (https) and 22 (ssh).Also I have made sure that Apache user has proper previleges on the index.html and other folders under DocumentRoot folder. I have also verified that /etc/host on my MAC is correctly pointing to a guest running on VirtualBox.
I have set the firewall to :
setenforce 0
So hopefully it is not a SELinux issue.
Then I run following command on terminal as root user of my Centos7 OS :
curl https://localhost -k
and I do get the default index.html file content.
But then, when I go to my MAC OS browser to connect to VirtualBOX website on HTTPS, I see following message on Chrome browser :
This site can’t be reached localhost refused to connect.
Please note that I can connect to my Vbox CentOS HTTPD server on HTTP.
So what is going wrong here when trying to access the apache server using HTTPS?
You must enable access to https using firewall-cmd:
# firewall-cmd --permanent --add-service=https
or
# firewall-cmd --permanent --add-port=443/tcp
then reload the rules
# firewall-cmd --reload
Try this once.
systemctl stop firewalld
After that try to access website.

Cannot access localhost:8080 from laravel

I have a PHP application running on homestead box. This application makes calls to another app that is running on glassfish on my localhost:8080.
When PHP application sends the request to localhost:8080, I am getting following error:
ConnectException in RequestException.php line 49:
cURL error 7: Failed to connect to localhost port 8080: Connection refused
Still I can make calls to localhost:8080 from web browser.Anyone has any suggestion?
Seeing how your application is running in Homestead (which by default is available on 192.168.10.10 and is forwarded to also be accessible on localhost:8000) your application running on Glassfish will not have access to it using localhost:8080. This is because localhost in your vagrant box (Homestead) is not actually the same localhost as on the host machine.
What you could do is grab the ip address from the host machine and connect to it from your application running in Homestead.
So here is how I could solve the problem. Vagrant is the guest machine running on my localhost as host machine. To access host from guest, you need to use gateway from VB.
I found this answer which helped me to access my application on localhost.

Resources