I am using XAMPP for Linux, but when I try to open a PHP file saved in a folder saved in home directory, the browser downloads the PHP file instead of displaying it. What could be the problem?

XAMPP Status is:

Component                        Status         Hint
MySQL database                   ACTIVATED
PHP                              ACTIVATED
Perl                             ACTIVATED
Common Gateway Interface (CGI)   ACTIVATED
Server Side Includes (SSI)       ACTIVATED
PHP extension »OPcache«          DEACTIVATED    See FAQ
PHP extension »OCI8/Oracle«      ACTIVATED

Some changes to the configuration sometime may cause false negative status reports.

What could be a possible solution?

  • is the phpmyadmin and index.php of xampp working fine? – kamil Feb 8 '14 at 15:15
  • Have you tried the answer? – kamil Feb 13 '14 at 11:36

If you try to access a PHP file saved in your home folder, it will be downloaded instead of saved. Just move it to your www folder commonly found in /var/www and give it 644 permissions and try again.


check php.ini

You might be using short tag <? ?> or <?= ?> instead of <?php ?>.

The short_open_tag should be On.

short_open_tag = On

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.