**Update** Php file won't load using Apache as a Service - php

I have installed apache as a service on my Windows 10. I also have installed PHP and have that configured correctly. I'm making this assumption because I can create a PHP file in the htdocs directory with phpinfo() and get the expected results.
I have a PHP file located in htdoc folder (The same file I can run phpinfo() in) and go to 127.0.0.1/my_php_file.php and I get the error "This site can't be reached"
I have searched the logs for the apache service and there are none there.
Update
Here is the file's contents
<?php
$servername = "test";
?>
And it gives me the error "This site can't be reached"
The only error in the network tab has a status of "Failed" when loading the page

Related

Apache2 and php localhost

I have installed apache2 on my windows 8 ,after it got installed i opened localhost and instead of showing it works page it showed a page with title Apache2 Ubuntu default page and though "it works" was written on it too but it has written "You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server." on it. i neglected it then and continued to install php on it and again in the end when i opened localhost it showed that page again.
Now issue is why its showing ubuntu default page when i'm installing on window secondly how to follow "You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server." like where is this path on windows.?
Look around in C:/Program Files for an Apache folder. If I remember, the conf files should be there and they should tell you where the html files are.

php and apache http server installation issue

I have installed php-5.4.42-Win32-VC9-x86 and apache_2.4.2-x86-no-ssl.msi in my PC.
According to this
Link
I have installed PHP and apache server and configured. I have restarted my computer after configuration.
I created a phpinfo.php file in the website folder. When i try to run this file in the browser(http://localhost/phpinfo.php) i am getting webpage not available error. But when i run the localhost i am getting as "It Works".
Also when i test the configuration i am getting error as "syntax error on line 172 in httpd.conf, cannot load c:/PHP/php5apache2.2_dll into server.The specified procedure could not be found."
I resolved the problem of this error by changing phpapache2.2_dll to phpapache2.4.dll. I hadve both of them in my php folder.
My PC has 32 bit OS.I have also specified the path of PHP in environment variable.
But still when i run my file i am getting webpage not available.
Can any one help me to resolve this problem.

PHP not working on CentOS

I copied a wordpress installation into my html-folder on my server var/www/html, but it does not show up in my browser afterwards, instead it shows a apache test-page which is located in var/www/error.
If I copy a file named index.html into html-folder, it indeed shows up when I visit my website. To test PHP i have created a index.php on /var/www/html/test/ now once i go to mydomainname/test/index.php then it shows only PHP soruce code. Apache and PHP are installed on my CentOS, also restarted apache after that. Can you help?

Apache downloads PHP files instead of displaying in browser when called via CMD (Ubuntu)

I've installed LAMP on my Ubuntu laptop with no apparent problems and successfully did the phpinfo() test by navigating to the file through the browser. But the same file is downloaded instead of executing when I'm trying to build from Sublime Text 3 using the following script:
{ "cmd": ["/opt/google/chrome/google-chrome" ,"$file"] }
That worked the first couple of times I tested it, but stopped right after I changed the name of the build system and hasn't been functioning since even after I reversed the change. How would I go about fixing the issue?
$file is "The full path to the current file, e.g., C:\Files\Chapter1.txt.".
Apache isn't causing the file to be downloaded; you aren't requesting it from Apache.
You need to translate $file into a URL on your HTTP server.

XAMPP & PHP - file downloads instead of running

I am trying to run a PHP script from my browser. I have XAMPP installed. Status shows that all the important stuff is activated, including PHP. I have a directory under htdocs called test in which I have a very simple index.php file with the following contents:
<?php phpinfo(); ?>
If I go to: localhost/test I get a satisfactory result will all sorts on information in a nice table. When I go to localhost/my_other_dir I see a list of two files, as follows:
52719c32376853836_20..> 2013-10-30 19:56 55M
installer.php 2013-10-30 19:55 527K
I expect that if I click on the installer.php file it will run the script and do some cool stuff that involves the other file in the directory. This was working a couple of hours ago and I'm not aware of anything that I changed, other than installing XCode Command Line Tools on my MacBook, which is running Mavericks.
When I click on installer.php, however, instead of running the script it just tries to download the file. What gives?
My server status shows the following:
XAMPP Status
This page offers you on one view all information about what's running and working and what's not.
Component Status Hint
--------------------------------------------------------------------
MySQL database ACTIVATED
PHP ACTIVATED
Perl ACTIVATED
Common Gateway Interface (CGI) ACTIVATED
Server Side Includes (SSI) ACTIVATED
PHP extension »OPcache« DEACTIVATED see FAQ
PHP extension »OCI8/Oracle« DEACTIVATED see FAQ

Categories