Title: Loading php code in javascript tag
Last modified: October 16, 2020

---

# Loading php code in javascript tag

 *  [Diletec](https://wordpress.org/support/users/diletec/)
 * (@diletec)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/loading-php-code-in-javascript-tag/)
 * Hi.
 * When configuring the AWS CDN in the plugin it presents the following error: Uncaught
   SyntaxError: Unexpected token ‘<‘
 * The error is because the plugin is trying to load PHP code into the javascript
   tag.
 * File: [https://d3n3c8rpwp6bs7.cloudfront.net/wp-content/cache/autoptimize/autoptimize_be34bfac9799a07b2b421b8184239fbd.php](https://d3n3c8rpwp6bs7.cloudfront.net/wp-content/cache/autoptimize/autoptimize_be34bfac9799a07b2b421b8184239fbd.php)
 * File code start:
    <? php
 * // Check everything exists before using it
    if (! isset ($ _ SERVER [‘HTTP_ACCEPT_ENCODING’]))
   $ _SERVER [‘HTTP_ACCEPT_ENCODING’] = ”; if (! isset ($ _ SERVER [‘HTTP_USER_AGENT’]))
   $ _SERVER [‘HTTP_USER_AGENT’] = ”;
 * // Determine supported compression method
 * How it is being loaded:
    <script src = “[https://d3n3c8rpwp6bs7.cloudfront.net/wp-content/cache/autoptimize/autoptimize_be34bfac9799a07b2b421b8184239fbd.php”&gt](https://d3n3c8rpwp6bs7.cloudfront.net/wp-content/cache/autoptimize/autoptimize_be34bfac9799a07b2b421b8184239fbd.php”&gt);
   </script>
 * This file should not be being imported through a scrypt tag.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/loading-php-code-in-javascript-tag/#post-13545518)
 * looks like you’re using push CDN but the CDN (obviously) does not execute the
   PHP code.
 * either disable the CDN for Autoptimized files or enable the “serve as static 
   files” option to have the files served as static .js files.
 * hope this helps,
    frank

Viewing 1 replies (of 1 total)

The topic ‘Loading php code in javascript tag’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/loading-php-code-in-javascript-tag/#post-13545518)
 * Status: not resolved