473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

php syntax question

Hello. Rank php newbie, here. I just setup my Slack 12 httpd to run php
based on advice I found in Linuxquestions. I finally got it working, but
the prob was not the config, which I had no prob with, but the syntax of a
simple php file. The test.php file given was:

<? phpinfo(); ?>

.....which didn't work. But, fooling around with some other expamples, I
noticed <?php ? syntax instead of just <? ?>. I added the "php":

<?php phpinfo(); ?>

.....and the test file worked just fine. So, what's the deal? Is there a
configuration I can make or does php5 (apache2) always require the "php" in
the tag?

thank you,
nb
Jun 2 '08 #1
5 1227
On Sun, 18 May 2008 21:20:41 +0200, notbob <no****@nothome.comwrote:
Hello. Rank php newbie, here. I just setup my Slack 12 httpd to run php
based on advice I found in Linuxquestions. I finally got it working, but
the prob was not the config, which I had no prob with, but the syntax of
a
simple php file. The test.php file given was:

<? phpinfo(); ?>

....which didn't work. But, fooling around with some other expamples, I
noticed <?php ? syntax instead of just <? ?>. I added the "php":

<?php phpinfo(); ?>

....and the test file worked just fine. So, what's the deal? Is there a
configuration I can make or does php5 (apache2) always require the "php"
in
the tag?
Search the manual for short_open_tags. And rather then enabling it (which
could cause trouble with XML, and make your script not work on a server
with it disabled), just change all your php tags to proper <?php.
--
Rik Wasmus
....spamrun finished
Jun 2 '08 #2
On Sun, 18 May 2008 19:20:41 GMT, notbob wrote:
Hello. Rank php newbie, here. I just setup my Slack 12 httpd to run php
based on advice I found in Linuxquestions. I finally got it working, but
the prob was not the config, which I had no prob with, but the syntax of a
simple php file. The test.php file given was:

<? phpinfo(); ?>

....which didn't work. But, fooling around with some other expamples, I
noticed <?php ? syntax instead of just <? ?>. I added the "php":

<?php phpinfo(); ?>

....and the test file worked just fine. So, what's the deal? Is there a
configuration I can make or does php5 (apache2) always require the "php" in
the tag?
It's the configuration variable short_open_tag in the php.ini file.
Whether you want to turn it on or not is up to you but be aware that if
you're wirting things for placement in an environment where you may not
be in control of the php.ini (such as a hosted space), you may want to
discipline yourself to use the full open tag always.

--
41. Once my power is secure, I will destroy all those pesky time-travel
devices.
--Peter Anspach's list of things to do as an Evil Overlord
Jun 2 '08 #3
On May 18, 12:20 pm, notbob <not...@nothome.comwrote:
....and the test file worked just fine. So, what's the deal? Is there a
configuration I can make or does php5 (apache2) always require the "php" in
the tag?

thank you,
nb
<? ?can be just about any scripting language on a webserver (and if
it is IIS it could very well be ASP).

<?php ?can only be php

Use the longer tags and life will be good, and you will not have to
fix it later (IIRC PHP 6 will require long tags).
Jun 2 '08 #4
On 2008-05-18, Peter H. Coffin <he*****@ninehells.comwrote:
discipline yourself to use the full open tag always.
Thank you, Rik and Peter. I suspected something like that and so will leave
the config option be and use proper php syntax. I've been doing likewise
with html (no <p tags) and have noticed less problems. I'm finding it's
better to take the time up front than spend more time debugging.

nb
Jun 2 '08 #5
On Sun, 18 May 2008 13:00:14 -0700 (PDT), la***@portcommodore.com wrote:
On May 18, 12:20 pm, notbob <not...@nothome.comwrote:
>....and the test file worked just fine. So, what's the deal? Is there a
configuration I can make or does php5 (apache2) always require the "php" in
the tag?

thank you,
nb

<? ?can be just about any scripting language on a webserver (and if
it is IIS it could very well be ASP).

<?php ?can only be php
Indeed, and there's little to nothing that I can think of that would
prevent a (im)properly configured webserver from parsing the same page
for multiple different script languages. It would be ... interesting to
write for if you knew which would be processed first, and a nightmare if
you didn't.

--
When you have a thermic lance, everything looks like hours of fun.
-- Christian Wagner in a.s.r
Jun 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
4
by: Aaron Walker | last post by:
Greetings, I'm attempting to write my first *real* template function that also deals with a map of strings to member function pointers that is making the syntax a little tricky to get right. ...
2
by: bor_kev | last post by:
Hi, First of all, i want to use the new managed class syntax and STL.NET under Microsoft Visual (C++) Studio 2005 Beta. I read in a Microsoft...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
3
by: astromog | last post by:
I have some significantly extended syntax for Python that I need to create a reference implementation for. My new syntax includes new keywords, statements and objects that are sort of like classes...
11
by: deppy_3 | last post by:
Hi! The syntax of fputs() is similar with the syntax of fgets(); For example if we have:fgets(str,maxlen,stdin) which is the syntax of the fputs();
8
by: Smithers | last post by:
Are there any important differences between the following two ways to convert to a type?... where 'important differences' means something more profound than a simple syntax preference of the...
2
by: berrylthird | last post by:
This question was inspired by scripting languages such as JavaScript. In JavaScript, I can access members of a class using array syntax as in the following example: var myInstance:myClass = new...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
6
by: Daniel | last post by:
I hope this question is OK for this list. I've downloaded Rpyc and placed it in my site packages dir. On some machines it works fine, on others not so much. Here is one error I get when I try...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.