PHP not working on CentOS - php

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?

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.

wamp -> php only loads in index.php not in other file names

So I've had this problem a while that my php will only execute in
index.php but not in files like: login.php this will just show plain
code. I am not using short tags. I recently reïnstalled wamp and it's
running on windows 10 home 64x specific version of
wamp: 3.1.0 wamp64
php: 5.6.31
module is loaded in apache and .php is reggistered as php file in
httpd.conf here is an example of an index.php and here is an
example of login.php I hope someone is able to help me :)
I've already looked at other posts and tried them but none worked.
There is nothing wrong with the 2 files. But only 1 loads.

my "phpinfo.php" file loads a completely blank page in both firefox and safari [duplicate]

This question already has answers here:
PHP code is not being executed, but the code shows in the browser source code
(35 answers)
Closed 7 years ago.
Background: I want to learn PHP and in the tutorial that I'm doing, one of the first things it has you do after getting PHP and mySQL going is to to test it by making a phpinfo.php file and opening it.
Problem: In FireFox, the file loads a blank page. In Safari it only shows the code that I wrote: <?php phpinfo(); ?>.
Steps so far (not necessarily in order):
I followed the steps at http://coolestguidesontheplanet.com/how-to-install-php-mysql-apache-on-os-x-10-6/
I have made a phpinfo.php file using text editor in plain text mode (as opposed to rich text) and saved that in my "sites" folder. This is the only line in that file:
<?php phpinfo(); ?>
In system preferences, I have web sharing turned on and mySQL server running. I have removed the # from in front of the load php 5 module line in the httpd.conf file as per the tutorial I mentioned. I've tried restarting the web server using "sudo apachectl restart" and then restarting Firefox.
I looked for a php.ini file in my etc folder. There wasn't one but I did find a php.ini.default. I duplicated that file and renamed the duplicate to php.ini. I'm not sure this step was a correct step to take but from the little I could find on the internet it looks like somebody else has done this and I thought, why not?. (phpinfo.php loaded a blank page before and after this step)
I typed php -i | grep php.ini into terminal and got the following:
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
and a timezone warning
So I decided to look for a php.ini in the /private/etc folder and there is one there. ( The one I created was in the /etc folder not the /private/etc folder.)
I have searched the internet including this website for answers.
System info:
When typing php -v into terminal it tells me that I am using PHP 5.3.28
When typing mysql -v into terminal it tells me that I am using mySQL 5.6.10
I am running Mac OS 10.7.5 on a Macbook Pro.
FireFox version: 40.0.3
Safari version: 6.1.6
Questions:
1) Did I correctly create the php.ini file?
2) What am I missing? Why is the phpinfo file not loading in my browser?
3) Is the timezone warning important?
Make sure that your source code file has the .php extension in the end.
If you can see the code of your php file in your browser, probably your apache server is not started or it is not working properly. To set your development environment quickly, I recommend that you download an "all in one package" such as XAMPP server or WAMP server. It comes with everything that you need to get your php project working and it is very easy and quick to install.
Take a look at: https://www.apachefriends.org/index.html
Once you have installed the package, create a folder for your project and put your php file inside it. So, copy your project folder to "htdocs" folder, inside the WAMP or XAMPP path, open your browser and type the URL:
http://localhost/yourProjectFolder/phpinfo.php
You shall see your php file working on.
Good luck!

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

Categories