Solved

PHP Syntax

Posted on 2011-03-15
3
305 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
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

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

680 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