Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed php5 on Ubuntu, but it's not running. How do I get it running? Or more generally, how do I start an application software that doesn't have an entry in init.d?

share|improve this question
Do you have apache up and running? – LnxSlck Aug 8 '12 at 15:12
@Lnxslck yes... I disabled apache by default, and I have just got it running. Does this have an effect? – xczzhh Aug 8 '12 at 15:14

If Apache is running (check by using a browser to go to apache address), then try this to see if php is running:

vi /var/www/info.php

<?php phpinfo();?>

Call that file in a browser (e.g. http://ipapacheruns/info.php), it could be (e.g. http://localhost/info.php):

share|improve this answer
+1 This is the best and easy way to test a successfully installed and running PHP. – Geppettvs D'Constanzo Aug 8 '12 at 15:53
Seems that there is something wrong with Apach2. I can't even open the index.html page from a web browser. I must did something wrong. I remember using the command sudo update-rc.d apache2 disable 2 this day earlier... but I have enabled it, even restarted the system... :P – xczzhh Aug 8 '12 at 16:10
So what it looks like, is that your apache isn't running correctly, until you get the page showing the words "It works" or something like that, you won't be able to get php running. – LnxSlck Aug 8 '12 at 16:11

php5 runs as an Apache module, not by itself, so as long as you have Apache running, it should be ready to process php scripts. You need to have libapache2-mod-php5 installed for this, and you may need to enable it with sudo a2enmod php5. When you restart apache, you can look in /var/log/apache2/error.log and you should see something similar this:

[Sun Aug 05 06:33:46 2012] [notice] Apache/2.2.16 PHP/5.3.3-7+squeeze13
 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations

The PHP part tells you the module is ready to process php content.

share|improve this answer
Thanks for the answer. I did exactly what you said, but it's still not running, even if apache2 is running well(with 6 processes). :P – xczzhh Aug 8 '12 at 15:39
Please check apache is running with a web browser – LnxSlck Aug 8 '12 at 15:50
oops... seems not. Can't open the default page... – xczzhh Aug 8 '12 at 16:06
do you have any firewall software running? (ufw for instance). – roadmr Aug 8 '12 at 19:47

There are two main implementations of PHP: the Apache module (libapache2-mod-php5) and the terminal interpreter (php5-cli). The Apache module will cause Apache to check any files ending in .php for PHP script and run that script when a client requests that file. For this to happen, you need to install the package and request a PHP file through Apache.

The terminal interpreter is accessed by typing php into a terminal, and will allow you to type PHP directly (with a few modifications to handle linebreaks and execution).

PHP doesn't run as a window or anything like that. The phrasing of your question and your responses to others give me the impression that you don't what PHP is. It's a language, not a program.

share|improve this answer
Thank you for the answer :). I do know what PHP is, in order for .php files to run, a php parser is needed, and here the parser is just the program version of PHP. I have previously installed several times the apache AND php packages separately, and they tend to work okay, I am not sure why it doesn't this time... – xczzhh Aug 8 '12 at 15:50

Your Answer


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.