note 88964 modified in function.realpath by danbrown

From: Date: Sun, 15 Feb 2009 22:15:10 +0000
Subject: note 88964 modified in function.realpath by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150713@lists.php.net to get a copy of this message
for those who want to start realpath on windows platform and looking for example. OR for those who want to run zend framework on windows platform using the quick start guide <?php define( "_CUR_OS", substr( php_uname( ), 0, 7 ) == "Windows" ? "Win" : "_Nix" ); function checkCurrentOS( $_OS ) { if ( strcmp( $_OS, _CUR_OS ) == 0 ) { return true; } return false; } // public/index.php // // Step 1: APPLICATION_PATH is a constant pointing to our // application/subdirectory. We use this to add our "library" directory // to the include_path, so that PHP can find our Zend Framework classes. if ( checkCurrentOS( "Win" ) ) { $mappath = '/' . str_replace( "\\", "/", str_replace( "C:\\","", dirname(__FILE__) ) ); } else { $mappath = dirname(__FILE__); } define('APPLICATION_PATH', realpath( $mappath . '/../_privateadico/application/') ); set_include_path( APPLICATION_PATH . '/../library' . PATH_SEPARATOR . get_include_path() ); ?> I took the index.php for zend which is was written for unix and ported it to windows. The porting problem was with realpath function not understanding dirname(__FILE__) syntex on windows --was-- for those who want to start realpath on windows platform and looking for example. OR for those who want to run zend framework on windows platform using the quick start guide define( "_CUR_OS", substr( php_uname( ), 0, 7 ) == "Windows" ? "Win" : "_Nix" ); function checkCurrentOS( $_OS ) { if ( strcmp( $_OS, _CUR_OS ) == 0 ) { return true; } return false; } // public/index.php // // Step 1: APPLICATION_PATH is a constant pointing to our // application/subdirectory. We use this to add our "library" directory // to the include_path, so that PHP can find our Zend Framework classes. if ( checkCurrentOS( "Win" ) ) { $mappath = '/' . str_replace( "\\", "/", str_replace( "C:\\","", dirname(__FILE__) ) ); } else { $mappath = dirname(__FILE__); } define('APPLICATION_PATH', realpath( $mappath . '/../_privateadico/application/') ); set_include_path( APPLICATION_PATH . '/../library' . PATH_SEPARATOR . get_include_path() ); I took the index.php for zend which is was written for unix and ported it to windows. The porting problem was with realpath function not understanding dirname(__FILE__) syntex on windows http://php.net/manual/en/function.realpath.php

« previous php.notes (#150713) next »