• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

.txt files get parsed by php

C

Cepe

Guest
Hi,

how can I disable that .txt files get parsed by php?
On my old server (with Plesk 7.5) I had a .txt file which contained php code (including the opening <?php and closing tags ?>) with some example code for download.
Now, after upgrading to a new server with Plesk 8.3, this .txt file with example code gets parsed by php just like a regular .php file.

I have checked the /etc/httpd/conf.d/php.conf file (which I have not changed) and it only has
AddHandler php5-script .php
AddType text/html .php

written in it (among some other lines, but nothing with .txt).

Gladly awaiting any ideas,

Cepe.
 
check that .txt is not defined as application/x-httpd-php nowhere in /etc/httpd/conf/httpd.conf, /etc/httpd/conf.d/php.conf, vhost.conf for the domain or .htaccess in directory where affected *.txt files are.
 
Hi ib1984,
.txt is not defined anywhere as application/x-httpd-php.

But I have found out something new:
The file parsed by php was called "demosource.php.txt".
By renaming that file to "demosource.txt" it did not get parsed any more, like it should. It seems, that having ".php." in the file name is enough (demosource.php.txt.test.xyz also gets parsed by php, but demosource.phptxt does not).

Well, guess I'll just rename the file to .txt instead of .php.txt.
 
Yes, indeed, I had reproduced it on my server. Seems like some glitch in Apache and how it handles filetypes. Thank you anyway for bringing it out.
 
by the way you may just give these files .phps extension and enable .phps 'AddType' line in php.conf. It will show sources (even with syntax highlighting)
 
by the way you may just give these files .phps extension and enable .phps 'AddType' line in php.conf. It will show sources (even with syntax highlighting)

great Idea, thanks! Done ;)
 
Back
Top