The requested URL [filename].php was not found on this server - php

I tried to run a Netbeans PHP project as a local website (running on local server), however, when I run it, there is a 404 not found error. The error message is:
Not Found
The requested URL /index.php was not found on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
And when I tried to visit localhost/test.php, the same error appears. I have turned on Apache and MySQL by using /etc/init.d/apache2 start and sudo /etc/init.d/mysql start commands. And this is the PHP setting in my Netbeans. Do I need to connect the project to the server or do some other configuration?

Related

Apache2 server can't find files in same folder

Absolute beginner here, correct me if I've done mistakes.
I'm trying to create a login system on an apache2 server (OS: Ubuntu server 20.04 LTE) and I can access all pages from another computer(OS Win10 home) in the same WiFi-net but they won't connect to each other even though they're in the same folder. Chrome says
Not Found
The requested URL was not found on this server.
Apache/2.4.41 (Ubuntu) Server at 192.168.0.184 Port 80
Meaning I can't switch between pages using links nor use a php-file to handle the form-input. http://ip-adress shows all the avaliable files in /var/www/html but they can't connect to each other.
Opera says above too
You need to enable mod_rewrite, To enable run the Following command:
sudo a2enmod rewrite
Then restart apache2 by the Following command :
sudo service apache2 restart

how to run apcahe2 localhost in nitrous.io Ubuntu Stack

I am running ubuntu stack on nitrous.io cloud platform.
I want to run php files on it and install apache2 server on it also.
But I am unable to run localhost on it;
It giving error of "port not specified" when I am taking preview of it, on port 3000.
Please help me out regarding this.
I am following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
apache default port is 80
configure port
change the local host to 0.0.0.0 instead 127.0.0.1
This will solve the problem
[![enter configure the port ][2]2

cannot connect to localhost after installing yosemite

I am trying to connect to localhost and I am getting the following error on the browsers (chrome and ff and safari)
Browsers connection attempt to localhost was rejected.
i tried
telnet 127.0.0.1
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
and
Barry$ / : curl localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
the httpd.conf is set to LISTEN : 80
However I can connect using thin on localhost:3000 for a rails project
I've looked at other similar Q's and answers but cannot find a fix.
Check your Apache config with this command:
sudo apachectl -t
This tests the config files and tells you if there's an error. Running sudo apachectl start does not output config file syntax errors to the logs for some reason.
Do u have skype or pow installed ?
I just wanted to post my solution to getting localhost working again.
I used the following process to reinstall apache and update the ports.
It worked for me so I hope it can help someone else.
I do mention at the bottom that im still getting an unfound url error, so if anyone can help, that would be great.
RE-BUILDING APACHE
port search apache2
Warning: port definitions are more than two weeks old, consider using selfupdate
sudo port uninstall apache2
sudo port -v selfupdate
Ensure that Xcode command line tools are installed or else you get a warning:
Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.
xcode-select —install
sudo port upgrade outdated
sudo port search apache2
then i did a reinstall of apache2
sudo port install apache2
sudo port load apache2
This got Localhost back up and running on port 80 for me however I'm not out of the woods yet.
when i go to my dev sites using
localhost/~barrymcmahon/
im getting the following error
Not Found
The requested URL /~barrymcmahon/php_5_advanced/ was not found on this server.

phpMyAdmin get error 404 for php 5.5.8

I just upgraded my PHP version from 5.3 to 5.5.8
When i was trying to connect back to phpMyAdmin i got the message:
Not Found
The requested URL /phpmyadmin/ was not found on this server.
Apache/2.4.6 (Ubuntu) Server at 192.168.168.59 Port 80
What can be the problem?
I restarted to apache2 server and updated all the apps with sudo apt-get update
Try reinstall phpmyadmin and it was the simple way to do so.
Because, it maybe PHP5.5.X removed PHP/APACHE virtual host. If you know how to put it back the virtual host, you may try it. else try reinstall it

Internal Server Error on PHP files

I've configured PHP5, Apache2 in a debian machine. And the PostgreSQL server is in a different machine. ODBC connection is successful when i use this command in the terminal isql -v [database name] and i even can execute the queries successfully. But the challenge is when I open the PHP files through Chrome i'm getting the error like the one in the snapshot below [Web Console].
I've configured the ODBC in my local Windows Machine and I can see the result of the same PHP file when executed through my Local WAMP Server but i get the error when i try to open it through the Linux machine.
Somebody please help me on this.
How is your PHP configured? suPHP, FastCGI, CGI or DSO? You should also be able to take a look at the error logs for Apache:
tail -n 200 /usr/local/apache/logs/error_log
That will list the last 200 lines. You need to be looking for the 500 error. I suspect it's due to permissions, so you may also want to check out the suexec log:
tail -n 200 /usr/local/apache/logs/suexec_log

Categories