note 88964 added to function.realpath
| From: | info | Date: | Sun, 15 Feb 2009 22:13:40 +0000 |
| Subject: | note 88964 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150712@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
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
----
Server IP: 212.199.163.191
Probable Submitter: 79.180.0.248
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/88964
Del: integrated -- https://master.php.net/note/delete/88964/integrated
Del: useless -- https://master.php.net/note/delete/88964/useless
Del: bad code -- https://master.php.net/note/delete/88964/bad+code
Del: spam -- https://master.php.net/note/delete/88964/spam
Del: non-english -- https://master.php.net/note/delete/88964/non-english
Del: in docs -- https://master.php.net/note/delete/88964/in+docs
Del: other reasons-- https://master.php.net/note/delete/88964
Reject -- https://master.php.net/note/reject/88964
Search -- https://master.php.net/manage/user-notes.php