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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • howa

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

    ini_set( "short_open_tag ", 1 );

    phpinfo();

    still showing 'off'

  • Erwin Moller

    #2
    Re: Why ini_set( "short_ope n_tag", 1 ) didn't work?

    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.


    Comment

    • Michael Fesser

      #3
      Re: Why ini_set( &quot;short_ope n_tag&quot;, 1 ) didn't work?

      ..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

      Comment

      • howa

        #4
        Re: Why ini_set( &quot;short_ope n_tag&quot;, 1 ) didn't work?


        Erwin Moller ¼g¹D¡G
        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

        Comment

        • howa

          #5
          Re: Why ini_set( &quot;short_ope n_tag&quot;, 1 ) didn't work?


          Erwin Moller ¼g¹D¡G
          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

          Comment

          • Erwin Moller

            #6
            Re: Why ini_set( &quot;short_ope n_tag&quot;, 1 ) didn't work?

            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?



            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

            Comment

            • howa

              #7
              Re: Why ini_set( &quot;short_ope n_tag&quot;, 1 ) didn't work?


              Erwin Moller ¼g¹D¡G
              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?
              >

              >
              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.

              Comment

              Working...