FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


using <? instead of <?php (solved)





badai
my whole php code begin with <?, not <?php

so i upgrade from php 2.2.x to 2.3.0

apparently, now it will only work if my php code start with <?php

if i start with <? it will just dump it as html.

i got hundreds of php files, most are mixed with html code where php code are all over the place between html, I don't think it's a good idea to automatically do search and replace. to manually do search and replace obviously will take too much time.

i think i may make mistake while i configure php. this is what i configure before compiling:

--with-apxs2=/usr/local/apache/bin/apxs \
--disable-debug \
--enable-ftp \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-mbstring \
--enable-safe-mode \
--enable-wddx=shared \
--with-gettext \
--with-mysql=/usr/local/mysql \
--with-regex=system \
--with-zlib-dir=/usr/lib \
--enable-sigchild \
--with-gd \
--with-freetype-dir=/usr/share/X11/fonts/TTF \
--enable-gd-native-ttf \
--enable-xml \
--enable-soap

or, is it something else i need to do?

thanks.

to fix, set short_open_tag = On in php.ini
Hogwarts
Usage of "<?" is bad form anyway, and should be avoided. Inclusive of this, <?=$foo?> is also equally bad.

Also, why use PHP 2? O_O

Annd, just to finish this off, having hunreds of PHP files which are 'mixed with HTML' means that you didn't really write your site in the best way possible. A framework and generation would have been better Sad
badai
typo. upgraded from php-5.2.6 to php-5.3.0. not 2. version 2 is the new apache, 2.2.12.

also, now we are using extjs for our applications, and php for back end. so no more mix html and php. only html+script. php and css are separated.

those php+html was from last 2 years before we started using javascript framework.
AftershockVibe
"<?" is a hold back from the early days of PHP (which is renowned for not having a very well thought out design). There is probably a config setting somewhere to re-allow it which the upgrade overwrote.

However, as Hogwarts said, using it is considered bad form as goes against the practice of standard XML-style markup on which most modern web standards (HTML being the obvious one) are based.
rvec
If you want to use it you can search for the short tag setting in your php.ini file ("short_open_tag"). You shouldn't if you write your own code, but sometimes you just get a lot of code with shorttags and have no choice.
Related topics
Implementing your database access in PHP as a layer.
How to load external text and html?
using cookies in PHP
day image
Simple PHP script not working
Can frames be a good choice? What then?
php/HTML pages question
Remote display of text
Problem with PHP
150 frih to make this SIMPLE script
Pls help, onmouseover popup image frm database
Using PHP "OR" Logical Operator
Using PHP code from a Database
IE8 not allowing new random image on each page (PHP and CSS)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.