I have found the solution of this problem. May be this can help for future users.
The html project was running fine. The problem was with php files. so I had to enable the php module using-
Code:
$ sudo a2enmod php5
but it was giving error
Code:
ERROR: Module php5 does not exist!
I tried to find php5.conf file in
/etc/apache2/mods-available but it was not there. I made it myself and put the following code in it.
Code:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
Now there should be php5.load file in
/etc/apache2/mods-available but it was not there too.I made it too myself and put the following code in it.
Code:
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
Note:- i just checked that
libphp5.so was available or not at its given path and my good luck, it was there.
Now I made links of php.conf & php.load and put links into
/etc/apache2/mods-enabled
Code:
ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load
Now I ran-
Code:
$ sudo a2enmod php5
This time it gave me message-
Code:
Enabling module php.
Run '/etc/init.d/apache2 restart' to activate new configuration!
The problem is solved ,Now I could run my php-web-project through apache2. The path of php-web-project is
/var/www/php-web-project
Note:- If the command
$ sudo a2enmod php5 gives error. Change file name php5.conf to php.conf, php5.load to php.load and change the name of links respectively php.conf & php.load and run the command
$ sudo a2enmod php
Now project should be run fine.
If you are not able to log-in. It means data base is not connected properly. Restart mysql server. If you are still not able to do this.
Open your config file of php-project and change host name
'localhost' to
'127.0.0.1'.
Now it should work fine.