index.php codeigniter not loaded in virtual host apache2 on ubuntu

I have apache2 that installed in ubuntu 14.04 . My plan is to put my codeigniter application’s folder that called “tresnamuda”. I know the default virtual host in ubuntu is /var/www/. So, I put the “tresnamuda” into /var/www/tresnamuda.

But, it gives me blank page. When I right clik on internet browser, the contains of index.php is loaded like this :

<?php

/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting...........

I dont know where is the error, coz in /var/www/tresnamuda/.htaccess contains code like this :

RewriteEngine on
RewriteBase /tresnamuda/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

In apache conf on /etc/apache2/sites-available/tresnamuda.com.conf, I write like this :

<VirtualHost *:80>
   ServerAdmin itjkt@tresnamuda.co.id
   ServerName 192.168.5.222
   ServerAlias http://192.168.5.222
   DocumentRoot /var/www/html/tresnamuda
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

In /etc/apache2/apache2.conf, I write like this :

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All   
    Require all granted
</Directory>

I have try a lot of times. I use sudo a2ensite tresnamuda.com.conf
, i t still blank page when I access on internet broswer like this : http://192.168.5.222.

Please, any advice it so appreciated.


Source: .htaccess

1 Comment

  1. Digin Dominic

    It sounds like PHP isn’t installed, or that at least PHP isn’t configured with Apache. Do PHP files in the root folder run correctly?

    If not, you’ll need to install PHP

    sudo apt-get install php5

    Then, once that’s done, restart Apache

    sudo service apache2 restart

    If PHP is installed, I’ve found a resource on digital ocean which might help. The relevant part, i think, would be:

    It may also be useful to add php to the directory index, to serve the relevant php index files:

    sudo nano /etc/apache2/mods-enabled/dir.conf

    Add index.php to the beginning of index files. The page should now look like this:

    DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm

    Reply

Leave a Reply