Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

php - Extension PHP5 does not parse in XAMPP

I've installed XAMPP Apache server and put my website into htdocs. I've started Apache server. On my website I've got files with extension PHP and with extension PHP5.The difference is that when I type in into browser localhost/file.php - I see a parsed website.

But when I type localhost/file.php5 (i have this file on server), than browser asks me if I want to download or open this file. And if I choose open than I see PHP code of file.php5!

I've looked into configuration, so:

  1. I dont have htaccess file
  2. PHPINFO() shows PHP 5
  3. c:xamppapacheconfextrahttpd-xampp is included into configuration and has this on the beginning:

    AddType application/x-httpd-php-source .phps

    AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt

I've tried also to put:

AddHandler php5-script .php5
AddType text/html .php5

Into httpd.conf, but it does not work for me (no changes).

Could you please help me fixing it? I would like to have php5 and php extension files to be opened with php5 parser.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Follow the path c:/xampp/apache/conf/extra/httpd-xammp

    Open httpd-xammp

  2. Find the area of the text that resembles this:

    <FilesMatch ".php$"> 
       SetHandler application/x-httpd-php   
    </FilesMatch>
    <FilesMatch ".phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    
  3. replace the top line of the code with the following:

    <FilesMatch ".php$|.php5$|.php4$|.php3$|.phtml$|.phpt$"> 
    
  4. so the text resembles the following:

    <FilesMatch ".php$|.php5$|.php4$|.php3$|.phtml$|.phpt$"> 
        SetHandler application/x-httpd-php  
    </FilesMatch>
    <FilesMatch ".phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    

That worked for me.

Good luck..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...