Debian 7.2 and PHP5 installation problems

I’m not new to Linux, but I am new to php. I’m trying to set up a lamp server. Using Debian 7.2, Apache2, Mysql, and PHP.

I want to install wordpress eventually.

Doing all this in a VM using virtualbox (4.2.10).

Now, have installed the OS. Using apt-get installed apache, mysql, and php.

Apache is installed. the test page displays.

Mysql I can log into the mysql cli.

The php test page does not display. The browser (firefox) says it can’t find the file. This test uses the code as follows:

it was placed in /var/www (the same place the test index.html file is.

Further, when I type php -a to invoke the interactive php shell, it seems to halfway work. It acts as if I was in a cli shell, except it doesn’t display any kind of a prompt. Further, I can type stuff into this, but it does nothing except move to the next line (after pressing the enter key, as if it was text editor) or nothing. For example, type “echo 5+8;” produces nothing.

Looking up documentation on installing these components in debian, the docs say I should have a file in a modules diirectory somewhere. Using find I cannot fine a file nor a directory module or modules.

So, a little help here. Anyone have a clue why this is not happening?



I’m not sure what you used for installing, but I typically use:

apt-get install php5 php5-cli php5-curl php5-gd php5-mysql phpmyadmin

Then as far as Apache is concerned, inside /etc/apache2/mods-enabled you should see php5.conf and php5.load
php5.load will have LoadModule php5_module /usr/lib/apache2/modules/
php5.conf will have the rules for which files get sent to the php parser.

Hope that helps.

That info helped a lot. /etc/apache2/modules wasn’t installed, and therefore the file wasn’t anywhere.

I did an apt-get remove for all the :installed" php packages and reinstalled as per your suggested install, and still the directory wasn’t created and the so file was no where.

So, how do I force/create the folder with the required files inside?


Ah, I missed a very important package to install libapache2-mod-php5

apt-get install libapache2-mod-php5

That should setup php5 in apache. Sorry. I did this just a few months ago, and completely forgot I had done that too.

Even though this is for ubuntu the steps look the same for debian.

Here is a good article explaining setting up vhosts and configuring apache on linux.

That’s because at Ubuntu’s core lies Debian :slight_smile:

Makes sense.

Just the other day I had to set up a linux vm w/ lamp stack on a windows host. Though before then I had never used linux.

OK, done that several times. While this process does create the directories /etc/apache2/mods-enabled and mods-available, it doesn’t create or populate /etc/apache2/modules

Don’t understand why not.

Is there a way to force it? Or create this area and populate it manually?


The modules directory is /etc/apache2/mods-available.

In the terminal you can enable the php5 module using the command: sudo a2enmod php5

Though I believe that module should already be enabled. You can check in the directory /etc/apache2/mods-enabled to see if there is a php5.conf and php5.load file. If there is than the php5 module is already enabled. If not you can run the previous command to enable the php5 module.