Vote for my Idea~~~Open-source Software and Patience go hand in hand~~~
Vote for my Idea~~~Open-source Software and Patience go hand in hand~~~
Solved it..
Added the 'AddType' handler in /etc/apache2.conf and bingo,prob is resolved..
Vote for my Idea~~~Open-source Software and Patience go hand in hand~~~
Hi,
PHP file is not being executed,it is offered as a download.I installed LAMP as
apt-get install apache2
apt-get install php5
apt-get install mysql-server
I have tried everything like
sudo a2enmod php5
Module php5 already enabled
even re-installing libapache2-mod-php5
sudo apt-get purge libapache2-mod-php5
sudo apt-get install libapache2-mod-php5
I am using public_html directory and it is working fine.MySQL is working perfect and i can access it from the Terminal.
Note:
My computer Hard disk is faulty and i had sent it for a repair.I am using Ubuntu 10.10 as Live CD and installing lamp on it and intent to save the source php files on an external hard-disk.
I have tried the ApachePHPMySQL ubuntu documentation and whole lot of online resource.Nothing works.Any Idea will be appreciated.
Thanks in Advance
Suffering with the same problem. I tried to add "AddType application/x-httpd-php .php .htm .html" or "AddHandler" in .htaccess. None worked.
Does anybody solved the problem if so please help us. Thanks.
My test html file with simple PHP snippet
--------------------------------------------------
<html>
<head></head>
<body>
<h1>
<?php echo "I LOVE PHP!"; ?>
</h1>
</body>
</html>
Hi trinetra
I don't use LAMP a lot but I tested this for you.
I copied your script and saved it as /Data/Temp/trinetra.html
Then I booted to the LAMP partition (different OS installation)
I opened it with Firefox as file:///Data/Temp/trinetra.html:
nothing.
I copied it to /Data/html/LAMP/trinetra.html and opened it with Firefox as file:///Data/html/LAMP/trinetra.html :
nothing.
I copied it to /Data/html/LAMP/trinetra.php and opened it as
http://localhost/trinetra.php
and got:
I LOVE PHP!
in big bold letters.
The moral of the story:
You need to save the file as *.php not *.html
You need to have the file in the path of http://localhost
You need to open it as localhost not as a file.
If you got those three things right and it still doesn't work then let's work on http://localhost and where it points.
Gigabyte GA-MA790GPT-UD3H - AMD Phenom II x3 720 - 8 GB RAM - 2009 - My first PC from parts!
@Ridgeland: Thanks a lot for responding and helping me with my problem.....
Few observations that I found after your suggestion......
1. You are correct that I used to open the test.html (trinetra.html) as a file in Firefox and nothing is displayed.
2. But after your direction to open the file with http://localhost/test.html
I had placed the file in /home/test/public_html/ directory as index.html
and changed the entries in /etc/apache2/sites-available/default to point to my new location than /var/www/
and restared the Apache server. But I went into permission/ access problem.
3. Later I tried with default location i.e. I placed the test.html in /var/www as index.html and restarted the Apache server....
Boom that's it, I got "I love PHP" in big letters.
Though I didn't changed the extension as php, still as html I could able to open the file in browser. But the catch is instead of opening the file with absolute path (i.e. the path in your machine), I tried to open as helped by Ridgeland like http://localhost/ or http://localhost/test.html. In both the cases the php snippet got executed without any problem even if the file extension is html (I wonder why it didn't worked for "Ridgeland").
Ridgeland you saved my day ........
Have fun...
But... when the server sees a request for a *.php the server sends the *.php through an extra step to process any php code and display the result.
You can set up the server so *.html is treated like *.php. In that case every html page even those that do not have php code in them still has to go through a wasted process of checking for php code but not finding any then displaying the result.
My first efforts with *.html failed because the server was set up correctly and did not search *.html for php code. My hack of processing all *.html for php code wastes server resources. For my home server that is trivial. For a large corporation it would matter.
Gigabyte GA-MA790GPT-UD3H - AMD Phenom II x3 720 - 8 GB RAM - 2009 - My first PC from parts!
Bookmarks