LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PHP File gets Downloaded instead of Showing the configuration (https://www.linuxquestions.org/questions/linux-newbie-8/php-file-gets-downloaded-instead-of-showing-the-configuration-4175411888/)

abhiionweb 06-17-2012 04:13 AM

PHP File gets Downloaded instead of Showing the configuration
 
well i have everything installed on my LAMP .. the apache2.4.2 is running and php5 too is installed ....

But the problem is that when i am running my http://localhost/test.php the browser shows me the code written in the test.php as : <?php phpinfo(); ?>...

I have AddType application/x-httpd-php .php in my httpd.conf file also but this does not seem to work !!

What could be the problem and related solution.

Thanks in advance !!

prabampm 06-17-2012 05:17 AM

did u restart ur apache after installing php?? seems php has not been detected by the webserver. kindly give more details so that it ll be easy to understand the issue. for instance how did u install LAMP? is it from repo or binaries like bitnami??

abhiionweb 06-17-2012 09:16 AM

@pabhampm : yes i restarted Apache after installing php but the file is not giving me the configuration details : instead it is showing me the file contents .... I installed all LAMP contents by basically downloading and unzipping the contents of .tar.gz packages !!

Zetec 06-17-2012 09:23 AM

Which OS are you using? What packages did you install for PHP?

rosehosting.com 06-17-2012 09:24 AM

It looks like you haven't loaded the libphp5.so module in your apache web server, but anyhow please provide us with more details such as, what linux distro you're running, why not installing LAMP through distro's package manager (if any) etc...

anyhow this is Arch Linux specific ( => https://wiki.archlinux.org/index.php/LAMP#PHP ), but should point you how to load the php module in apache. do not forget to reload the webserver for the change to take effect.

headrift 06-17-2012 09:28 AM

Which distro are you using? tar.gz packages are usually source packages. It sounds like your Apache is running on a Linux, which is a good start, but it's obviously not configured right for php. Are you going to be running php as a module or as a CGI interpreter?

abhiionweb 06-17-2012 12:03 PM

i am using Linux Mint 13 "Maya" - Cinnamon (32-bit) and i used the php available here : http://www.php.net/get/php-5.4.4.tar.gz/from/a/mirror ....and basically i am a newbie and i am trying my hands on LAMP and main motive is to run basic php programs though this ....

rosehosting.com 06-17-2012 12:05 PM

Quote:

Originally Posted by abhiionweb (Post 4705524)
i am using Linux Mint 13 "Maya" - Cinnamon (32-bit) and i used the php available here : http://www.php.net/get/php-5.4.4.tar.gz/from/a/mirror ....and basically i am a newbie and i am trying my hands on LAMP and main motive is to run basic php programs though this ....

Try with this => https://www.google.com/search?sugexp...x+mint+13+LAMP

abhiionweb 06-17-2012 12:11 PM

yes i did refer to it but as i mentioned i am already done with every part of the installation the only thing that's creating the problem is : " The php file shows me the content " i.e it is not getting Parsed i guess .

headrift 06-17-2012 12:34 PM

Quote:

Originally Posted by abhiionweb (Post 4705524)
i am using Linux Mint 13 "Maya" - Cinnamon (32-bit) and i used the php available here : http://www.php.net/get/php-5.4.4.tar.gz/from/a/mirror ....and basically i am a newbie and i am trying my hands on LAMP and main motive is to run basic php programs though this ....

You linked to a page of mirrors for the source tarball. Compile it first. *nod*

abhiionweb 06-17-2012 12:43 PM

it was this link : http://in3.php.net/get/php-5.4.4.tar...php.net/mirror

headrift 06-17-2012 12:51 PM

Right... and presuming you compiled it correctly, running `php -v` at a prompt should show you some version information.

If not, then it's probably not actually installed.

Beyond that, it could be that Apache or php was compiled with the wrong MTM -- or most likely that Apache is just configured wrong. Try adding "LoadModule php5_module modules/libphp5.so" to your httpd.conf file. The path might be wrong, but it's a start. Also check your logs for errors.

abhiionweb 06-17-2012 01:11 PM

running php -v gives : PHP 5.3.10-1ubuntu3.1 with Suhosin-Patch (cli) (built: May 4 2012 02:21:57)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

That means its installed ...right ??

LoadModule php5_module modules/libphp5.so is also present in httpd.conf

headrift 06-17-2012 01:15 PM

Okay. The php 5.4.4 file you downloaded isn't the one you're using. You're running the Ubuntu version which seems to be 5.3.10 -- try this link:

https://help.ubuntu.com/community/ApacheMySQLPHP

abhiionweb 06-17-2012 01:20 PM

yeah out of this frustration i used sudo apt-get install php5 which in turn installed PHP 5.3.10 ..... but hey now the error changed and its showing me 404 for my test.php ...

headrift 06-17-2012 01:25 PM

Your Apache is probably still not set up... make sure test.php is in the DocumentRoot directory specified in httpd.conf -- that's usually what does that.

abhiionweb 06-17-2012 01:26 PM

yeah now going for it !!
tasksel seems to be the only way for this mess ...Tasksel Installing packages

abhiionweb 06-17-2012 01:31 PM

it is in /usr/local/apache2/htdocs as specified in DocumentRoo of httpd.conf

abhiionweb 06-18-2012 05:35 AM

the problem persists it shows me the "404 not found " error for localhost/test.php ....

W_o_R 06-19-2012 06:45 AM

Quote:

Originally Posted by prabampm (Post 4705352)
did u restart ur apache after installing php?? seems php has not been detected by the webserver.

that worked for me.
thanks!


All times are GMT -5. The time now is 12:52 AM.