Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have recently installed apache 2.2 from repos. Im trying to run php and jsp pages using that server.

What Im doing is ,Frist Im creating the pages using Gedit and then copy/pasting them to var/www

When Im trying to access the pages from localhost Im getting raw text. The scripts on those pages does not executing.

When I run "php -version" Im getting this:

PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 02:17:16) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

I have php,apache so what I need more to do to run PHP ?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Installing the CLI version of PHP does not install PHP for Apache. For that, you need to install the libapache2-mod-php5 package.

share|improve this answer

you might also need to enable the module with the command

sudo a2enmod php5

and then reload the apache configuration with

sudo /etc/init.d/apache2 reload

if you ever want to disable the module for apache, the command is

sudo a2dismod modulename
share|improve this answer
    
* Reloading web server config apache2 ulimit: 88: error setting limit (Operation not permitted) httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'graceful' failed. The Apache error log may have more information. –  Curious Apprentice Apr 28 '12 at 3:13
    
Not working ! What is wrong ? –  Curious Apprentice Apr 28 '12 at 3:14
    
It says httpd not running then how im getting this when I use localhost: It works! This is the default web page for this server. The web server software is running but no content has been added, yet. –  Curious Apprentice Apr 28 '12 at 3:15
    
@CuriousApprentice You need sudo. –  Lekensteyn Apr 28 '12 at 16:56

We can run both LAMPP and apache2 on Ubuntu. When you need to start LAMPP just stop apache. Here's the command:

sudo /etc/init.d/apache2 stop

When you need to start apache2 use this commans:

sudo /etc/init.d/apache2 start
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.