Solved

PHP Syntax

Posted on 2011-03-15
3
307 Views
Last Modified: 2012-05-11
Hello,

We have a pretty extensive php app built up, with all php code in the format:

<?  ?>
instead of <?php ?>

We installed a new Apache server, and we only seem to be able to get php code to work if the brackets are in the <?php ?> format.  I can see how this is better practice, but do we have any options, other than going through all the source code, changing the format?

The server is a Mac OS X 10.6.4 server, fully updated.

Thanks
0
Comment
Question by:compsol1993
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Assisted Solution

by:k_romych
k_romych earned 100 total points
ID: 35141093
in file php.ini set short_open_tag = On
0
 
LVL 2

Accepted Solution

by:
wrightsonm earned 300 total points
ID: 35141112
Add this as the first couple of lines to your site:

		if(ini_get('short_open_tag')==0){
			ini_set('short_open_tag',1);
			if(ini_get('short_open_tag')==0){
				die('PHP short tags are currently disabled.  This site won\'t work without short tags enabled');
		
			}
		}

Open in new window


if ini_set doesn't work you will need to find your php.ini file and change the parameter:

short_open_tag = On

Dont forget to restart apache!
0
 
LVL 3

Assisted Solution

by:pius_babbun
pius_babbun earned 100 total points
ID: 35148788
k_romych's answer is exacty correct

and if you need more explanation please check this link below

http://php.net/manual/en/ini.core.php


Hope this is helpful.

Change this in you ini file or use ini_set function to set it at the run tine

Hope this is helpful to you !
short-tag1.JPG
short-tag2.JPG
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question