Solved

PHP Syntax

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

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…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 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