CodeIgniter Forums
PHP files downloading instead of running? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: PHP files downloading instead of running? (/showthread.php?tid=70889)



PHP files downloading instead of running? - sksabbirali - 06-13-2018

.htaccess file contents

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^(.*)$ index.php?/$1 [L]
# Use PHP 5.4
AddHandler application/x-httpd-php54 .php
Options -Indexes

When i am deleting the .htaccess file php project opens it home page. but not working any other page like admin, users etc. But when I am putting the .htaccess file to the folder a file is downloading autometically instead of running.

Please help me.

Sk Sabbir Ali


RE: PHP files downloading instead of running? - InsiteFX - 06-14-2018

Server Requirements
PHP version 5.6 or newer is recommended.


RE: PHP files downloading instead of running? - Pertti - 06-19-2018

Are you trying to use URL rewrite (www.domain.com/index.php?admin --> www.domain.com/admin)?

In .htaccess file you are telling .php files to be run through PHP parser - I wonder if it doesn't recognise that you are redirecting everything to index.php, and uses URL (www.domain.com/admin) instead, which now doesn't have .php file extension.


RE: PHP files downloading instead of running? - sksabbirali - 06-19-2018

(06-19-2018, 01:04 PM)Pertti Wrote: Are you trying to use URL rewrite (www.domain.com/index.php?admin --> www.domain.com/admin)?

In .htaccess file you are telling .php files to be run through PHP parser - I wonder if it doesn't recognise that you are redirecting everything to index.php, and uses URL (www.domain.com/admin) instead, which now doesn't have .php file extension.

I am trying with tp://www.domain.com/admin. please help me out.


RE: PHP files downloading instead of running? - Pertti - 06-20-2018

(06-19-2018, 10:51 PM)sksabbirali Wrote: I am trying with tp://www.domain.com/admin. please help me out.

Then it looks like server configuration issue to me.

Typically you don't have to associate PHP file extensions via .htaccess file, so your best bet is to contact your hosting supplier and talk with them, it really depends on specific supplier setup.