Solved

PHP Syntax

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now