Stop PHP execution <? in javascript

I am trying to implement TinyMCE, which works fine on my test setup, but on a production server, PHP is trying to execute tags '<?'that are in the file tiny_mce.js.

I have a file with a name html_editor.phpthat is entered into each form that requires it with include_once. Inside html_editorI have the following:

<script type="text/javascript" src="/Public/TinyMCE/tiny_mce.js"></script>

followed by Tiny MCE initialization, but it does not work on this line with unexpected T_CONSTANT_ENCAPSED_STRING. I replaced the script file with tiny_mce_src.jsto find the exact code causing the problem, and this:

html.push('<?', name, ' ', text, '?>');

I changed single quotes to paired numbers in tiny_mce_src.js, which fixes the problem, but in the minified code they are already doubled.

This is obviously the difference in configuration with PHP between my test and production servers, but I can’t track that. I am testing PHP 5.3, and 5.2 is running on the server.

+3
source share
2 answers

Why do JavaScript files go through a PHP interpreter ?!

Correct your server configuration to only process *.phplike PHP. How to do this depends on the web server you are using and how you use PHP; can you insert test and production configurations?

+6
source

you need to edit php.ini and install

short_open_tag=0

it will stop

being processed, it is a good idea no matter then you will use all your php scripts

0
source

All Articles