August 2nd, 2012, 07:49 AM
Parse .js files as php and serve with correct content type
I have this config in my vhosts conf file:
even the js-start.php file has a php header function call to set the content type
Options Indexes FollowSymLinks
Allow from all
php_value auto_prepend_file "C:\xampp\htdocs\dev.abcde.com\trunk\www\app\js-start.php"
AddHandler application/x-httpd-php .js
This is happening both locally on my widows computer (conf as shown above) and on my staging server (RHEL)
I've attempted with .htaccess as well in just the appropriate folder but that doesn't work either.
August 2nd, 2012, 08:46 AM
This by itself should be sufficient unless the header is being overwritten somewhere later in your PHP code.
How are you verifying that the files are being served as text/html? If you call die() immediately after your call to header() is the right content-type served?
August 2nd, 2012, 10:29 AM
Originally Posted by E-Oreo
I've not tried an immediate die, but when you said "unless the header is being overwritten somewhere later in your PHP code" it got me thinking....my framework does do some header stuff towards the end of script execution....i shall check there first