error when restarting Apache webserver - php

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.

Related

Blank PHP page on windows server 2012

My PHP page is showing blank page when I try and run it on the server by calling the IP to the windows server and the directory to it, when I try and run HTML on the same server it works.
When I run it on Apache localhost it works perfectly as well!
Can someone tell me whats the problem?
yeah, check the apache logs! probably your error reporting is off, it might be setting in your php.ini file (you can run php --ini to see files being used if you have shell access to server), just remember, there might a separate php.ini file used for running php shell from with command and separate for when it's run through web, just remember, get the right php.ini - this will show you errors :) and then you can see whats wrong with your app... on a linux server logs should be in /var/logs/httpd(or apache2 depending on your version)
btw. check this one http://php.net/manual/en/function.error-reporting.php

Apache2 server on raspberry pi will not run any php scripts

I have set up an apache2 server on the pi, but when trying to run any php file (placed in /var/www/html) the web page just responds with HTTP error 500. I have ran the index.html file and it works fine its only when php scripts are run that it gives me an error. I have also made sure that the php5 module is enabled in the apache configuration settings. Any advice on what to test from here would greatly help.
Update: Seems there was a problem with the permissions of the file. By giving read and write privileges by all users to the file it worked.

instead of opening php, browser downloads php in Ubuntu

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.

EasyPHP Cannot Connect to Localhost

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

Restarting Apache Using PHP in IIS

I'm trying to restart my Apache2.2 webserver using a bat file that is being called by a PHP running in IIS using exec(), Apache and IIS is in the same server.
PHP code
exec("cmd /c restart.bat");
bat file
"PATH_TO_APACHE\bin\httpd.exe" -k restart -n Apache2.2
When I load my php via http to restart, I get an "Unable to open logs" error in my Apache error log file.
Majority of my search results say that there is a port 80 conflict however when I do a netstat there is none, my IIS is listening to a different port. Double-clicking the .bat file works, but running it from the PHP gets the error. Any ideas? Please advise.
IIS runs all executable scripts under the context of a specified user, usually this is the IUSR_[MACHINENAME] account.
This account can be changed in the IIS configuration in the pool configuration.
The problem you're running into is probably that this user is not allowed to access the log file location.
To track this problem down I would:
1. (dangerous, use only for testing): put the IUSR account in the local administrators group. test again. if it works, you know it is a permission problem.
2. Try using the runas command to run cmd.exe as the IUSR user and execute your command in the console window, that way you see all error messages and test more easily.
3. allow IUSR to write to the apache log location.
A whole different attempt would be to create a marker file in PHP, and use a scheduled task run as Administrator to restart apache if that marker file exists. That way you do not need to give the IUSR account more permissions and have a separate code handling the restart.

Categories