Welcome Guest, Not a member yet? Register   Sign In
PHAR stream and the dirname() function @index.php
#1

[eluser]fMertins[/eluser]
Hi there,

I am using CI 2.0.2 at CLI and with PHAR stream (it is a command line application and my idea is using phar file to distribute/run the application in customer environment).

But I just realized today that function dirname() returns a "phar://" string at the beginning, so instead of get something like
Code:
/var/www/imap_test
I get
Code:
phar:///var/www/imap_test/imap_test.phar
and then the chdir() function at line 143 at index.php (front controller) fails:

Code:
PHP Warning:  chdir(): No such file or directory (errno 2) in phar:///var/www/imap_test/imap_test.phar/index.php on line 143

So, it seems this isn't a bug, but just a workaround to be done when working with phar files?
Thanks you!
Fernando
#2

[eluser]toopay[/eluser]
Phar spec is totally different with CI spec! Obviously, the only workaround for that is...hack all PHP filesystem functions (like 'include', 'file_get_contents', and so on) in CI to Phar spec.




Theme © iAndrew 2016 - Forum software by © MyBB