SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php configuration

    I have the following function in a custom 404 page.php

    It works fine on my remote host servers Apache but will not work on my local host at all. Identical files etc.

    I have tried to find out why - cannot do so?

    Most grateful if anyone can help
    The problem is the ini_get() function...........

    Thanks, Steve

    PHP Code:
    /* Function to check for existence of php page*/

    function include_path_file_exists($oldpath)
    {
       
    $paths explode(":"ini_get("include_path"));
       
    $result false;
       while ((!(
    $result)) && (list($key$val) = each($paths))) {
          
    $result file_exists($val $oldpath);
       }
       return 
    $result;


  2. #2
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ini_get returns nothing if the relevant value/flag is not set or empty. could the problem be that your local machine's php.ini is different from the one on your server ?
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  3. #3
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, and thanks!

    The Localhost version is identical code, and works the same except for this one function - so far.

    The 2 PHP versions are probably different though.

    Thing is - I have searched the PHP file and cannot see any reference to this function at all.

    It's important because the Localhost will be used for off-line demonstrations of an automatic (turnkey) php based system (when done).

    Regards, Steve
    www.flashability.net
    www. film-it.com

  4. #4
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thing is - I have searched the PHP file and cannot see any reference to this function at all.
    -- sorry I mean I have searched the php.ini file (and related php files).

    Steve.

  5. #5
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    include_path is easy to find in php.ini - this is what my local php.ini shows ...
    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; UNIX: "/path1:/path2"  
    ;include_path = ".:/php/includes"
    ;
    ; Windows: "\path1;\path2"
    include_path = "./;c:/php/includes;c:/inetpub/wwwroot"
    It is also easy to see what it is set to by creating and running a page which only has this in it ...
    PHP Code:
    <?php phpinfo() ?>
    ... include_path appears in the first table.
    Ian Anderson
    www.siteguru.co.uk

  6. #6
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *NIX uses : as the seperator , windows uses ;

    PHP Code:
    <?
    function include_path_file_exists($oldpath

       
    $sep=(stristr(PHP_OS,'WIN'))?';':':';
       
    $paths explode($sepini_get("include_path" )); 
       
    $result false
       while ((!(
    $result)) && (list($key$val) = each($paths))) { 
          
    $result file_exists($val $oldpath); 
       } 
       return 
    $result

    ?>

  7. #7
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That helped!
    The phpinfo on localhost gives a correct include_path reference to folder /includes

    I have looked into it and found it is empty - I assume it should not be empty?

    If you have any idea what I should put in it to get the php function ini_get working pls let me know ;-)

    But I will investigate further. I am a bit green when it comes to php installation as maybe you can guess!!

    Cheers!

  8. #8
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    crude but would not ...

    if(!@include($file)){/*do stuff*/}

    be a nice messy alternative ?

  9. #9
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by firepages
    crude but would not ...

    if(!@include($file)){/*do stuff*/}

    be a nice messy alternative ?
    Hi FIREPAGES!!

    I am using your Apache download, the PHP Version is 4.2.3

    Didn't realize it was you, so a big thank you!! it works straight off from the start - no probs on Win XP :-)

  10. #10
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $paths = explode(":", ini_get($_SERVER["DOCUMENT_ROOT"]."/includes"));
    Thanks guys!

    The above works for both local and remote hosts in the original function when replacing "include_path".

    Yep I feel happy but humiliated too!

    Kind regards, Steve.

  11. #11
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ini_get can only get values from the php.ini file... I have no idea what that is doing
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •