422,946 Members | 1,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,946 IT Pros & Developers. It's quick & easy.

Why ini_set( "short_open_tag", 1 ) didn't work?

P: n/a
ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'

Nov 23 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
howa wrote:
ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'
Hi,

ini_set() doesn't change the settings in php.ini.
It just (tries) to overwrite some value in php.ini for the duration of the
script that contains that ini_set().

And that is good. If everybody (on a shared hosting environment) could
change the real php.ini (by using ini_set), development would become very
troublesome because php.ini changes a lot. :-)

Regards,
Erwin Moller

PS: Overwriting short_open_tags is not very usefull, since this setting
should be known by PHP before parsing the php-file.
It is better to ALWAYS use <?php instead of relying on short open tags.
Nov 23 '06 #2

P: n/a
..oO(howa)
>ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'
'short_open_tag' is marked as PHP_INI_PERDIR, which means you can't
change it with ini_set(). Just use <?php and you'll be fine.

Micha
Nov 23 '06 #3

P: n/a

Erwin Moller gDG
howa wrote:
ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'

Hi,

ini_set() doesn't change the settings in php.ini.
It just (tries) to overwrite some value in php.ini for the duration of the
script that contains that ini_set().
well, how do I know which value in php.ini can be changed, and which
not?

seems can't find on the php.com

Nov 24 '06 #4

P: n/a

Erwin Moller gDG
howa wrote:
ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'

Hi,

ini_set() doesn't change the settings in php.ini.
It just (tries) to overwrite some value in php.ini for the duration of the
script that contains that ini_set().
well, how do I know which value in php.ini can be changed, and which
not?

seems can't find on the php.com

Nov 24 '06 #5

P: n/a
howa wrote:
>
Erwin Moller ???
>howa wrote:
ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'

Hi,

ini_set() doesn't change the settings in php.ini.
It just (tries) to overwrite some value in php.ini for the duration of
the script that contains that ini_set().

well, how do I know which value in php.ini can be changed, and which
not?

seems can't find on the php.com
Look again?

http://nl3.php.net/manual/en/ini.php#ini.list

Pay attention to the column named 'changable'.

And always test.
If you change some ini value, simply check inyour srcipt if it changed
succesfully.

It is considered (by me) good programming practice to have a file included
above all scripts (or at least the entrypoints of your site).
In this file you check a few thing that are important to the functioning of
your application.
Eg: are magic quotes on? Can you change the include-directory? etc.
Fail if some assumptions are not met with a clear complaint (eg: This
application needs mysqli to run, not mysql! mysqli not found.).

This has the advantage that when you change ISP or update your server, or
change to a newer version of PHP, your scripts will fail with a clear
complaint instead of failing in unpredicted ways.
Note: Some of these settings can NOT be changed when running in save mode.

Regards,
Erwin Moller
Nov 24 '06 #6

P: n/a

Erwin Moller gDG
howa wrote:

Erwin Moller ???
howa wrote:

ini_set( "short_open_tag", 1 );

phpinfo();

still showing 'off'

Hi,

ini_set() doesn't change the settings in php.ini.
It just (tries) to overwrite some value in php.ini for the duration of
the script that contains that ini_set().
well, how do I know which value in php.ini can be changed, and which
not?

seems can't find on the php.com

Look again?

http://nl3.php.net/manual/en/ini.php#ini.list

Pay attention to the column named 'changable'.

And always test.
If you change some ini value, simply check inyour srcipt if it changed
succesfully.

It is considered (by me) good programming practice to have a file included
above all scripts (or at least the entrypoints of your site).
In this file you check a few thing that are important to the functioning of
your application.
Eg: are magic quotes on? Can you change the include-directory? etc.
Fail if some assumptions are not met with a clear complaint (eg: This
application needs mysqli to run, not mysql! mysqli not found.).

This has the advantage that when you change ISP or update your server, or
change to a newer version of PHP, your scripts will fail with a clear
complaint instead of failing in unpredicted ways.
Note: Some of these settings can NOT be changed when running in save mode.

Regards,
Erwin Moller
Thanks.

Nov 24 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.