Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen I try to GZIP .js files using PHP I get some kind of php related error
    primarykey
    data
    text
    <p>Okay, So I've googled a couple of pages and come up with the following solution:</p> Add this in .htaccess <pre><code>#Active GZIP for php-files php_flag zlib.output_compression On php_value zlib.output_compression_level 5 </code></pre> <p>and this for .js and .css:</p> <pre><code>AddHandler application/x-httpd-php .css .js php_value auto_prepend_file /Library/WebServer/Documents/blog/code/Helpers/ContentHeader.php </code></pre> <p>Which will execute .js as well as .css as php scripts. The second row includes the following page:</p> <pre><code>&lt;?php $pathInfo = pathinfo($_SERVER['PHP_SELF']); $extension = $pathInfo['extension']; if($extension == "css") { header("Content-type: text/css"); } if($extension == "js") { header("Content-type: text/javascript"); } ?&gt; </code></pre> <p>Which will send header "text/css" to .css files and "text/javascript" to javascript files. So far so good. The problem however is with a couple of minified javascripts that I use I get some kind of php error:</p> <pre><code>&lt;br /&gt; &lt;b&gt;Parse error&lt;/b&gt;: syntax error, unexpected ']' in &lt;b&gt;/Library/WebServer/Documents/blog/public/scripts/prettify/prettify.js&lt;/b&gt; on line &lt;b&gt;18&lt;/b&gt;&lt;br /&gt; </code></pre> <p><strong>or:</strong></p> <pre><code>&lt;br /&gt; &lt;b&gt;Warning&lt;/b&gt;: Unexpected character in input: '\' (ASCII=92) state=1 in &lt;b&gt;/Library/WebServer/Documents/blog/public/scripts/showdown.js&lt;/b&gt; on line &lt;b&gt;29&lt;/b&gt;&lt;br /&gt; &lt;br /&gt; &lt;b&gt;Parse error&lt;/b&gt;: syntax error, unexpected '?' in &lt;b&gt;/Library/WebServer/Documents/blog/public/scripts/showdown.js&lt;/b&gt; on line &lt;b&gt;29&lt;/b&gt;&lt;br /&gt; </code></pre> <p>So, is there any better way of doing this? The only option I can come up with is to manually go in to the .javascript files and "correct the errors" that php doesn't like. But shouldn't it be a easier solution?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload