Apache2 and php localhost - php

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.

Related

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?

Ubuntu 14.04 apache2 configuration problems

yesterday i've setted up an Ubuntu 14.04 with php5, Apache2, mysql / mysql-php
Now i try to access my pages - first i've owned all files in my var/ww-directiory, the mainpage of my page worked.
Iǘe logged in in the page (self written cms), nothing working now.Chrome tells me an Internal Server-Error (500). but they are no errors displayed.
I've tried to change the php.ini to display errors, but the changes will be ignored.
With service apache2 stop
i have stopped the server, but the server is running...
What i have to do to see my errors and top stop the server?
In xampp (windows xp / windows 7, booth) the page workes fine. The page is in use on a real server, there it works fine too.
My .htaccess seems to be ignored (routing engine).
If i fill my index.php with "Hello World" (and nothing other) it doesnt work too.
But it seems that php is loading my application correctly, it started the session (seen at the cookies) which is started in other file, which is included from index.php.
An Internal Server Error is probably due to some mistake in your configuration files. That could be either apache2.conf (or any other apache configuration files that get loaded) or php.ini (or any of the additional config files that php loads).
By the way, .htaccess files are disabled by default, and you need to explicitly enable them using apache directive AllowOverride.
Another thing to notice is that, in ubuntu 14.04, you're probably using apache 2.4. There's some slight differences. The first one I've noticed is that site definition files inside sites-available need to end in .conf now.
You can test you config for errors using apachectl configtest (on linux).

wordpress downloading php file instead of viewing the webpage

I installed wordpress on my local machine (backtrack) for experimenting. After I got everything setup I moved it to an Ubuntu Server so that everybody can access those pages at work. I followed the same instructions, I moved the wordpress folder into /var/www but I created a new database with the same username, password and hostname.
The problem is whenever I access the webpage #ubuntu it tries to download the file, if access the page #backtrack it goes to the dashboard and everything is fine.
I did not have an .htaccess file on either machine sop I created one just to see if it will fix the problem but it did not.
Apache works fine because I can get to some folders I have setup by going to
"http://ubuntuserver/folder name"
and the logs shows no errors because it is delivering the webpage to the client just fine but the client is downloading it instead.
Any Ideas why this is happening??
Sounds like you haven't installed the PHP module for Apache or enabled it to use PHP using AddType in the Apache config file.
It seems that your WebServer ( Apache here, i suppose ) is not configured to use PHP module and/or is missing some PHP configuration options.
See here for some basic configuration tutorial.

iis7 serving .php file

I have a old php applications which was earlier hosted on Apache 2.2. Now I am trying to host it on IIS 7.5. I installed php with WebPlatform installer. Then copied directory to inetpub\wwwroot folder. Added this directory as application in IIS. But when I browse search.php, it pops up save as file dialog in the browser - asking to save the file. Instead should return the html response which browser can show.
If put sample index.php with phpInfo() in it. It works properly but not the acutal PHP files. Have I missed any steps?
Any php guys out there? I tried reinstalling, even with xampp, but no luck :(
You have installed it but might not be configured properly. You should follow instructions over here

No www folder is found in apache 2.2

I want to start learning php, I install apache 2.2 and I want to run my first.php file, I look for www folder in the installation folder of ApacheSoftwareFoundation but I couldn't find it.
here's the files in the apache
I tried to put my php file in htdocs but it doesn't work , can some one help ?
Edit
Doesn't work means when I make http:localhost/first.php , returns Unable to connect
Now the apache is running, when I open htt'://localhost/
returns "it works"
but when I open any php file, it opens as-is ?!
You'll need to check a couple of things...
Make sure the Web Server is running ,either the service
or the program, is running and that you have the correctly configured the Virtual Directories.
If the web server just outputs the
content of the .php file, it could
mean that you don't have mod_php
installed. Meaning the server does
not have the Mime type registered so
it will just try to treat it as a
text file ...
And as your on windows you might consider using something like XAMPP. It gives you a Full Working AMP (Apache Mysql Php) Stack with one install and a easy control manager to start/stop the servers. Other wise do a couple of Google searches on how to install the php module for your Web Server on Windows
Update
To start the server try executing the executable bin/httpd.exe .
Now the apache is running, when I open
http://localhost/ returns "it works"
but when I open any php file, it opens
as-is ?!
A default installation of Apache on windows does not include the necessary modules to run PHP. After installing Apache, you must either:
Install PHP separately and follow the instructions described here to configure Apache to use the installed version of PHP to serve .php files. I've been through this and took me hours to get every thing to work.
Recommended for you: uninstall Apache; install WAMP instead.
if you look in your httpd.conf file you will find the default root directory, it doesnt have to be called www. It is the htdocs by default.
error 500 covers a whole host of things. from compile error, to permissions.
Have you put a simple file of
<?php
echo "test";
?>
As your test php page to rule out other issues?
You need to:
Construct your URI correctly: http://localhost/first.php (with the //)
Ensure that Apache is running
all files in htdocs can be referenced from outside
Just put a basic file named index.php
and visit site http://localhost/
In general type in http://localhost/filename
You say that you get a connection error when you try to go to your webpage. Since it looks like you're using Windows Vista or 7, make sure you're running Apache as an administrator; it can't bind to port 80 otherwise. Also check that other programs like Skype aren't binding to port 80. If you still can't find the problem, check the error log. (logs/error.log by default I think)
The problem is that Apache was installed but not started
If you are using xampp start it and then start apache through control panel
for others look for similar instruction

Categories