I installed php and apache2 correctly, I am able to open localhost/index.php. Index.php is located in /var/www.
However when I open port 8000 by python -m SimpleHTTPServer 8000, localhost:8000/index.php will not be opened, the browser will just to start to download it.
I also add Listen 8000 in ports.conf.
What else do I need to change to make it work properly?
One more question, what do I need to change make php work in all files not just /var/www?
Thanks
You're using python to respond to the HTTP request, not Apache, so Apache never gets a chance to execute index.php.
Try Google to learn how Apache works.
I just solve my problem. I edited apache2.conf and add 8000 port, then I change the document root to my home directory.
Related
Here's the steps I took:
1)
2)
3)
For some reason I'm not able to figure out, this is not working. I'm a novice and I'm currently stuck here.
Any help will be much appreciated!
Thank you in advance,
Gabriel
you should consider installing apache webserver and setup the host file in your pc
Apache :
https://knowledgebase.progress.com/articles/Article/How-to-install-Apache-HTTP-Server-on-Windows-Server
Set Hosts file in win :
https://docs.serverpress.com/article/176-windows-10-and-localhost-is-blank
Create a new folder and then go to it in cmd using cd command. And move the file into it.
Then start the php server again and acces it using this link:
localhost:4000/site.php
Or install apache server as #mshahien said.
You can use xampp.
You are running php -S in the wrong directory.
The www directory is inside a directory called php somewhere inside your One Drive directory, but you are running php -S from a directory called i346241.
The server started by php -S takes the current directory to be the root of the development server.
I am new to php and have some experience with R opencpu.
Suppose I use localhost (127.0.0.1) to host my opencpu with the (default) port of 8004. Then, I cannot run the Apache using the same port. Instead, I have to run it in another port, say 8080. Then all my .php will be held on a server of the port 8080.
So how can I connect my .php files when running a opencpu app?
I thought that I could put my .php files in inst/www, where my index.html is. However, when I do so and open the page of http://localhost/ocpu/library/.../www/xxx.php, my browser automatically downloads the .php file but not executing it.
You'll need to ensure your web server is configured to properly serve PHP, which is a whole other thing. However, if you're only accessing files on localhost then you can just execute the PHP files directly using the system2() command.
output <- system2('php', c('/path/to/script.php', 'arg1', 'arg2'), stdout=TRUE)
Setting stdout=TRUE ensures the output from the script is returned for later use.
I'm using sftp to reach my folder on a server at uni. Both chrome and firefox would download my simple test.php instead of opening the page.
Is there any suggestion where should I look with the preferences to change this? (Ubuntu 16.04)
Oh, okay I understand it now, my bad.
I literally mounted the server to my local machine with ssh, thus I had no server whatsoever.
I had to reach directly with the url to open it, so I couldn't just open it from editor (VS Code - open with browser).
Your webserver isnt passing the php file to php for processing and is just sending it on as it would any other file. You will need to ensure that your webserver is setup to handle php correctly be it php-fpm for apache and nginx or the php module for apache
What's the webserver? You can start to read here: http://php.net/manual/en/install.php
I have had EasyPHP running on my system, but had to do a clean OS reinstall. Just downloaded and installed EasyPHP again, and Apache is running. But when I try to access the administrative page (127.0.0.1/home) through my web browser I get a "Oops! Google Chrome could not connect to 127.0.0.1" error.
I checked Apache's httpd file and it says it is listening on 127.0.0.1:80, which is exactly how I am trying to access the admin page through the browser. For some reason howver I am able to access the www folder with 127.0.0.1:8887.
I'm not very knowledgeable on EasyPHP so any help would be appreciated.
I had the same issue which was resolved by running the EasyPHP executable with admin privileges.
Update: I avoid installing EasyPHP into the Program Files folder and never had this issue again.
I was able to fix this problem by changing the listening port to 8887 like you did, but instead of saving it, do a 'Save As' and then overwrite it. It will ask you if you wish to overwrite the file, and just press 'yes'. This made the change permanent. Whenever I just saved it normally by pressing 'Save' instead of 'Save As', it would just create a new httpd file with the timestamp and not overwrite the original, which doesn't work.
Go to the Dashboard and change the port from 80 to 8080 then reverse to 80
Did you check apache error logs ?
In your easyphp toolbar you can see if apache is running (green icon)
By the way, try this command "netstat -b" and try to find "apache.exe" ( or "httpd.exe" depending of your easyphp version) listening on port 80.
But first, check your apache error logs, maybe there is a failure on your apache configuration files.
I had the same trouble today and when i tried to fix this changing the port by the EasyPHP program, this didn't resolve. If this occur try go to folder of the program/apache/conf and manually change httpd.conf.
Here the httpd of the program folder indicates 127.0.0.1:80 while httpd conf apache folder show 127.0.0.1:8887.
I hope had helped yours.
Regards
I installed Apache web server successfully.When I type the local host in browser it shows that it works. And then I save the php file to server httpdocs and restart it shows the the following alert.
Apache monitor is Already Started.
Please let me know where I am going wrong ?
You don't need to restart Apache every time you save a php file in httpdocs. just refresh you browser.