Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "<?" no longer working and instead only "<?php" works?

Tags:

php

xampp

I was using xampp to develop locally and then I installed the PHP from the direct installer. Now in some of my PHP code, only PHP code that starts with "<?php" is correctly parsed. Anything that starts with "<?" or "<?=" is completely ignored and just left as is.

How can I adjust the configuration to parse either tokens?

like image 714
Stephane Grenier Avatar asked Jan 12 '09 15:01

Stephane Grenier


People also ask

What does <? PHP mean in PHP?

What Does PHP Mean? The abbreviation PHP initially stood for Personal Homepage. But now it is a recursive acronym for Hypertext Preprocessor.

Why is my PHP script not working?

If you are running your PHP script on a Windows computer, you need to manually install PHP. If you haven't already done so, your PHP code won't execute. Instructions for the installation process, versions and the system requirements are listed at the PHP website.

Why PHP tag is not working in HTML?

Your web server will server the HTML page as is. It will only parse the HTML as best as it can. If you rename your page with a PHP extension, the web server will parse it using the PHP interpreter and that is when PHP will be interpreted.

Are PHP versions backwards compatible?

php has no backward compatibility in all version. It often removed some functions when it changed version. The problem occurs when you have to upgrade server and need to change php version but some php scripts no longer work with new php version. You also have to correct php script which is a bigger job.


2 Answers

I recommend you to disable short_open_tag and only work with <?php. When short_open_tag is enabled, it can collide with the XML processing instruction <?xml as both the PHP open tag and XML PI start with a <?.

like image 32
Gumbo Avatar answered Oct 26 '22 19:10

Gumbo


This is a php.ini setting named

short_open_tag = 1 # (enabled)
like image 86
Karsten Avatar answered Oct 26 '22 19:10

Karsten