Solved

LAMP setup for PHP code

Posted on 2014-11-28
6
125 Views
Last Modified: 2014-12-01
I have a centos 6 LAMP setup.

In page1.php
<html>
 <head>
  <title>Page 1</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'; ?>
 </body>
</html>

in page2.php
<html>
 <head>
  <title>Page 2</title>
 </head>
 <body>
 <? echo '<p>Hello World</p>'; ?>
 </body>
</html>


Page1.php will load and page2.php will not.  If I change the <? to <?php then the page loads correct.
I have been told that there is a change I can make on a .ini file that will tell the server to handle all <? as PHP code.
Where is that at?
0
Comment
Question by:knightdogs
[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
6 Comments
 
LVL 10

Accepted Solution

by:
10023 earned 400 total points
ID: 40471229
This is what i have in my wamp php .ini file
open in notepad from wamp button and use find:
; short_open_tag
;   Default Value: On
;   Development Value: Off
;   Production Value: Off
0
 
LVL 10

Expert Comment

by:10023
ID: 40471231
Centos
/etc/php.ini
Don't forget to restart server
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 40471270
I recommend that you do Not make that change and learn to use <?php as the opening tag all the time.  It always works but some servers have the short open tag <? turned off which will cause your code to fail as you have seen.
0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 
LVL 62

Expert Comment

by:gheist
ID: 40471896
correct way is to use ?php
because you can have multiple SSI languages, like mod_include, ruby passenger, jsp, you name it.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40471935
The reason to have the short open tag <? turned off is that it is also the opening tag for XML.  Using <?php avoids any confusion.
0
 

Author Closing Comment

by:knightdogs
ID: 40473612
10023- Thank you for your answer.  It fixed the issue

Dave Baldwin- Thank you.  I will have the coder fix that.
0

Featured Post

Industry Leaders: 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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

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