I installed LAMP from unixmen.com, but I am not able to run the php script using localhost. It says:
Not Found The requested URL /html/testphp.php was not found on this server. Apache/2.4.18 (Ubuntu) Server at localhost Port 80
Note! My apache server works fine.
Have you started your lampp server?
terminal command is
sudo/opt/lampp/lampp start
provided that is where lampp is installed.
Also the url should be http://localhost/name_of_your_project/testphp.php
first question: this file is first .php what executed in new serve?
case yes: make sure your server is started:
sudo/opt/lampp/lampp start
verify permission in your file.
or
try access using IP 127.0.0.1
http://127.0.0.1
your directory html are sub \var\www\html ?
try move to one level up
Regards
Related
I have installed a NodeJS module on a Digital Ocean Droplet. It generates a csv file that I store in the directory root/csv_file/my_file.csv.
However, I cannot access it in the browser by simply visiting ip_address/csv_file/my_file.csv.
I read this question which asks me to install http-server so I installed it. After that I ran the following command:
http-server csv_file
and
http-server root
However, none of the allowed me to access the file by visiting root/csv_file/my_file.csv.
Using the file_get_contents() function in PHP gives me the following error:
No connection could be made because the target machine actively refused it.
How can I access this file preferably in PHP or in browser?
Thanks.
http-server csv_file will serve in port 8080 by default.
Did you try http://your_ip_address:8080
Please make sure: the port is already opened/allowed (https://askubuntu.com/questions/911765/open-port-on-ubuntu-16-04)
I have a local Apache server using XAMPP which runs on port 80 and uses a local PHP file.
In the browser I can open this file from localhost/test/test.php and localhost:80/test/test.php.
I also have a react-native app, and it starts an NPM server on port 8081.
In this app I want to make a request to the local PHP file, but when I make the request it returns a 404 error.
I understand that it happens because the NPM server doesn't know about the local Apache server so I want to understand how to combine them.
Thanks.
don't write 'localhost/test/test.php'
You have to write with your ip, like this => '192.16x.x.x/test.php/'
we just migrated our production server to a new host (dedicated servers). And now we are unable resolve domain names from PHP pages when loaded from Apache. However, it works fine when we execute the php page from the command line.
For example, the following PHP code returns the IP address when executed from command line but fails when page is loaded in browser thru Apache.
$ip = gethostbyname('www.google.com');
echo $ip;
Any thoughts? We are running Apache 2.4 on Windows Server 2012.
Thanks for your help.
I have a proyect that is working on my main machine. I use the php -S localhost:8080 -t public command to start a local server. It works perfectly. But now I want to access it from another computer inside my own network but it does not work. In my other computer I type the ip address of the computer with the php server running like this 192.168.1.135:8080, but it does not connect. It just gives me timed out error. Any ideas on how to make this work?
I figured it out. Instead of localhost:8080, I changed it to 0.0.0.0:8080. That did the trick.
Need to start the (PHP)WebSocket on my Ubuntu server. its a working script at least on my PC (using WAMP server). Here is the code
<?PHP
include('php_web_socket.php')
$socket = new php_web_socket();
$socket->wsStartServer('127.0.0.1', 30001);
?>
I'm executing this php file by using the following command
php /var/www/html/server/index.php
But the WS connection never open.
For reference,
I'm using the following script http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket
I was making a mistake. Look the IP 127.0.0.1 - Localhost
lets allow the remote connection from rest of the world and change it to 0.0.0.0 and problem resolved!