Before starting I installed XAMPP. Now am trying to use nginx instead of Apache. For that I did the following steps:
Installed nginx (1. c:>cd nginx 1.8.0 2. start nginx). installed successfully.
Now am not able to load php files and localhost/phpmyadmin.
There are a handful of reasons for this behavior. Could you run through some of the following options? If they don't outright solve the issue they should provide greater context to help us resolve this.
What happens when you attempt to pull up the "localhost/phpmyadmin" website? If it attempts to save a file then nginx may not be properly configured to interact with the PHP interpreter to process the PHP code and provide it to the web server (nginx).
In the directory of your nginx installation there should be a "sites-available" directory containing a plain text "default" file. In this server you should find a declaration of a server block which, in turn, contains an identifier for the document root referred to as "root." Does this point to the directory containing the phpMyAdmin source code?
Are you able to pull up just "localhost"?
If option 3 is unsuccessful you can run something like "netstat -na | findstr /c:':80'". This will tell you if nginx is actually listening on port 80.
If option 3 is unsuccessful but option 4 shows results, you may want to pull up the listening IP address (or your assigned/static IP if it shows 0.0.0.0:80) in your web browser. For example: "192.168.1.100/phpmyadmin"
I hope this triage helps find the underlying cause of your issue.
I open the apache with Xampp from the IP direction and it works ok, that is in localhost it not work and in IP direction work fine.
Related
I'm doing some freelance work and the people I'm working with use a LAMP stack with docker. I've never used docker before and I am having some issues. They all use Macs, while I have windows so they have not been able to help me. I've been working on this on and off for the last 12 hours and cannot get my index.php page to show up. I'll go over the steps I've taken so far and provide the file structure.
I was working in windows powershell
Installed Docker Desktop from here
I followed the steps here to create a new docker-machine
2a. The command I ran was 'docker-machine create -d hyperv --hyperv-virtual-switch "DockerVS" default'
I then ran 'docker-machine env'
Then I ran '& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env | Invoke-Expression'
Then, while in the same directory, I grabbed the project from GitHub, changed directory into the location with the .env and docker-compose.yml files. then ran the command 'docker-compose up -d'
At this point, I was supposed to be able to run 'docker-machine ip default', paste that IP into my browser and see the page. That is what all my coworkers had done with their macs, at least. If it matters, the IP is 10.0.0.117
Now something is definitely running there, it attempts to get the "index.php" file, but it returns "File not found" to the browser. The page is also running phpMyAdmin, so if I type in 10.0.0.117:8080 to the browser, I see this page. So I'm confident that I'm on the right track, I just assume I've done something minor.
So the solutions I've attempted. My first guess was that I needed a port similar to :8080 that make the php page pop up. I ran 'docker-compose ps' and I tried the ports 443, 3360, and 9000 which I all see here:
Naturally no go. Next I tried various paths, and then tried all the aforementioned ports and paths together. The paths I tried were
/index.php
/index.html
/index
/index.htm
The above four with /public-html in front
The above with /LAMPProject in front
The file structure looks like this:
So all in all, that is what I am working with. It's a fairly simple docker LAMP set up before I start working on bigger stuff. Any advice at all would be very welcome.
I think you should map your phpmyadmin port to another one like 8081 instead 80, apache container mapped to 80 too.
My computer is a Windows 10 64 bit.
I tried to run my PHP code, steps:
Downloaded php.net.
Set the environment variables path as instructed. Ran the command line like this: https://imgur.com/a/Q9zs9mL
Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Mai Do>php -S localhost:4000
PHP 7.2.10 Development Server started at Mon Oct 22 21:04:32 2018
Listening on http://localhost:4000
Document root is C:\Users\Mai Do
Press Ctrl+C to quit.
Created a PHP file, first with NetBeans
Saved the file in the root directory folder named "php1" (try to be different from my root name)
Typed in browser: localhost:4000/php1/input.php
Object not found 404 page.
Tried multiple times with different php file. same thing.
Switch to Atom. Same thing.
Moved the file to htdocs folder. Same thing
Download Xampp. Turn on the Apache and MySQL. XAMP ver 3.2.2 control panel shows up. Both Button turn to Green. Still not found.
This SO page PHP not working in XAMPP says:
If you're trying to connect via your IP then your router must be
stopping it so you have to sort the settings out. I don't know your
router make/model you better off asking their support forums.
I am thinking there might be a server config problem. Like this one has a similar issue: Apache2 not working with routes PHP
which leads to this:
https://docs.bolt.cm/3.0/howto/making-sure-htaccess-works
"Editing the apache2.conf and setting 'AllowOverride All' on , finally
works." ???
I am not sure if that is the right problem either. Can someone walk me through it? Bless you.
To set up a test environment on your personal computer, follow the steps below:
Remove any installed PHP (Windows: uninstall via "Add/Remove Programs")
Install XAMPP (in your case, it's better to re-install the software suite)
XAMPP is a software suite that contains PHP + MariaDB (a fork from MySQL) + Apache Web Server + Perl. In your case, you are going to use PHP & Apache only.
Configure the DocumentRoot in Apache config file; you should put your website files in this DocumentRoot, thus I recommend you to set the path value to your development path. Read the manual if you're unsure how to do so.
Start/Restart Apache. If everything goes smooth, Apache should be up and running at port 80 (by default).
Launch your favorite browser and navigate to http://localhost
You should see your website written in PHP
If you have any further questions, please ask in the comment box below.
Note:
NetBeans is an IDE, not related to your testing environment
You can actually write your PHP scripts using any text editor
I have installed Apache2.2 on my computer, PHP 5, and MySQL. Everything was working fine until last night. Suddenly, I could no longer connect to the localhost. I think my computer was infected with a trojan, but that has since been removed and I am unable to reconnect to my localhost.
I have updated my hosts file Windows(C:)/Windows/System32/drivers/etc hosts in notepad: see attachment.
I have tested my connection in the CMD prompt see attachment.
You'll notice [::]1, but after updating my host file, it now displays as 127.0.0.1
Additionally, port 80 IS LISTENING
instead of my web browser loading the page as localhost/vote/home.php NOW it loads as file:///C:/Websites/Vote/home.php AND NOW my PHP no longer works i.e. not being pulled into my web page.
...can't establish a connection to the server at localhost.
Why is my local host not working? Thoughts? Thank you in advance.
Additionally, my web browser page does not time out when requesting localhost....
(I'm a new user so I am unable to post images)?
× 257296
if you put localhost/vote/home.php into your browser's address bar you should get an unabled to connect error,
not a redirect to a file. The only time the address bar will show file:///C:/Websites/Vote/home.php is if you open
that file directly in your browser.
Your details about why apache isnt working are not to clear, but you can try a couple of things.
First, how did you install apache, is it a service? you can check this by going to control panel > Administrative Tools > Services and
see if apache is in that list. If its, you have to start it, if its not then apache is not installed as a service and
you need to start it by running the executable. Go to the whichever directory your httpd executable is and run it.
Some things to try:
Make sure Apache is actually running, that it haven't failed during startup.
Check if it's listening to the expected port (80, or whatever you have configured it to)
> netstat -nb
Check your hosts file to make sure nothing fishy is going on there. localhost should point to 127.0.0.1, but maybe it's been set to point somewhere else by your virus thing.
If you can't figure it out, you can always try to remove/uninstall and try to set it up again. If this is a developer machine, I can recommend using the WAMP package installer instead of setting it all up yourself. It provides fairly easy switching between php/apache/mysql versions and easy switching on and off of most regular apache and php modules.
run command prompt as administrator and go to Apache bin folder (usually 'cd \apache\bin' ) and type httpd -k start. it worked for me with the same issue.
I had the exact issue. If you have a XAMPP control panel pull it up. There you will see XAMPP Control Panel Image the different modules that you have open... Apache will be one of them. In the 'Actions' column you will have 'Stop' adjacent to it. Hit the 'Stop' and wait about 1 minute for everything to calm down. The button will change to 'start' so hit it. This will reset Apache. It worked for me...Good Luck.
If you don't have the control panel on your desktop, go into your programs list and drop-down the XAMPP icon. The control panel is right there. Just click it and it will show
I followed installation instruction for PHP, MySQL and PHPMyAdmin. But when I tried to access http://localhost/phpmyadmin/, I got this error:
"Not Found The requested URL /phpmyadmin/ was not found on this
server.".
Then I tried to access just the localhost, still I got same error.
How can i fix this problem?
I'm using windows 7 (if this problem has something to do with that)
1 sudo nano /etc/apache2/apache2.conf
2 search insert: "Include /etc/phpmyadmin/apache.conf" at the bottom of file.
and restart apache2
sudo /etc/init.d/apache2 restart
you just need to delete cookies from your browser
press (ctrl + shift + delete) then
time range to clear : Everything
check -> Cookies then clear now
done.
There really isn't enough information to be able to give you a reasonable answer.
First check that your Apache is running. Goto your start menu and type services.msc into the text field.
Fairly high towards the top of the screen you will see ApacheX.X
See what the status of the service is. Try double-clicking on the Apache service and pressing Start if the service isn't running. If it has troubles starting you will get a message telling you the service couldn't be started.
I was just having this problem and i've come across an easier solution:
left click on the wamp tray icon
apache>
apache modules>
check the 'rewrite module'
bingo!
I just finished installing xampp 1.8.2 on WinXP XP2 machine and got same error show up on my Firefox 24.0 browser:
xampp Not Found The requested URL /phpmyadmin/ was not found on this
server.
I solved this problem by changing the proxy of my firefox browser, go to menu tools-Option find tab Network, click button settings. Fill the text box below No Proxy for with localhost.
In my case then it looklike:
192.168.1.0/24, localhost
Then press Ok, then Ok again.
Try now typing localhost/xampp then it should show Welcome to XAMPP for Windows!
Note: to change proxy for other browser may differ, check your browser help about how to change proxy.
Hope this help.
Most likely it is the port conflict for apache server, by default is must be using port 80. You can goto apache configuration file, http.conf and change the port to a different one like: Listen 0.0.0.0:10021
This solved my issue.
If using wamp, you can right click on wamp -> apache -> Use port other than 80, give a port number. Restart all wamp services.
If you are not able to access localhost :
One possible reason might be is your apache server is not started. Go to start menu of your computer and search services, open it, find Apache, start the program.(Considering all the configuration of PHP and Apache has done correctly)
If you are not able to access localhost/phpmyadmin :
First of all, add phpmyadmin folder to your working directory. Download it from https://www.phpmyadmin.net and unzip it. Add the folder to your working directory and change the name to phpmyadmin. Now you can access localhost/phpmyadmin. You will see a login page of PhpMyAdmin application. If you are seeing file directories instead of the login page, then go to your apache server's httpd.conf(apache/conf/httpd.conf) file. Edit it and change the index.html of DirectoryIndex to index.php
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
It also could be because you have changed the directory name, where the phpMyAdmin server sits. make sure the directory/folder name is correct and matches with the locations you used for Localhost to set up.
Also, make sure you have set up MySQL server.
I want to start learning php, I install apache 2.2 and I want to run my first.php file, I look for www folder in the installation folder of ApacheSoftwareFoundation but I couldn't find it.
here's the files in the apache
I tried to put my php file in htdocs but it doesn't work , can some one help ?
Edit
Doesn't work means when I make http:localhost/first.php , returns Unable to connect
Now the apache is running, when I open htt'://localhost/
returns "it works"
but when I open any php file, it opens as-is ?!
You'll need to check a couple of things...
Make sure the Web Server is running ,either the service
or the program, is running and that you have the correctly configured the Virtual Directories.
If the web server just outputs the
content of the .php file, it could
mean that you don't have mod_php
installed. Meaning the server does
not have the Mime type registered so
it will just try to treat it as a
text file ...
And as your on windows you might consider using something like XAMPP. It gives you a Full Working AMP (Apache Mysql Php) Stack with one install and a easy control manager to start/stop the servers. Other wise do a couple of Google searches on how to install the php module for your Web Server on Windows
Update
To start the server try executing the executable bin/httpd.exe .
Now the apache is running, when I open
http://localhost/ returns "it works"
but when I open any php file, it opens
as-is ?!
A default installation of Apache on windows does not include the necessary modules to run PHP. After installing Apache, you must either:
Install PHP separately and follow the instructions described here to configure Apache to use the installed version of PHP to serve .php files. I've been through this and took me hours to get every thing to work.
Recommended for you: uninstall Apache; install WAMP instead.
if you look in your httpd.conf file you will find the default root directory, it doesnt have to be called www. It is the htdocs by default.
error 500 covers a whole host of things. from compile error, to permissions.
Have you put a simple file of
<?php
echo "test";
?>
As your test php page to rule out other issues?
You need to:
Construct your URI correctly: http://localhost/first.php (with the //)
Ensure that Apache is running
all files in htdocs can be referenced from outside
Just put a basic file named index.php
and visit site http://localhost/
In general type in http://localhost/filename
You say that you get a connection error when you try to go to your webpage. Since it looks like you're using Windows Vista or 7, make sure you're running Apache as an administrator; it can't bind to port 80 otherwise. Also check that other programs like Skype aren't binding to port 80. If you still can't find the problem, check the error log. (logs/error.log by default I think)
The problem is that Apache was installed but not started
If you are using xampp start it and then start apache through control panel
for others look for similar instruction