-
Notifications
You must be signed in to change notification settings - Fork 102
wrong autoload location if installed with composer #21
Comments
I'm checking this issue and testing the possibility to use the bin options of composer to manage the zf.php. See the PR #20. I will update this issue asap. |
I've the same error, but it seems that it check the good directory. I've install with composer. ~/application/vendor/zendframework/zftool$ ./zf.php modules list |
I have encountered the same error, and that fix didn't work for me. |
I had the same issue installing the sceleton via git clone and then add zftool via composer. If i move the zftool directly into vendor the tooling works fine.
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"zendframework/zftool": "dev-master"
}
} |
Heya, am I correct in following that this is still not resolved? It's certainly still the case with my own zftool install. |
Same issue for me, and I can't seem to create the phar either:
|
Please Ignore commit a27e238 ;-) |
Thank you :-) |
The solution from noose is correct. |
I merged the PR #31 that seems to fix the issue. |
Is there a way to check how deep zf.php is installed? After installing with composer it 'thinks' base dir is APPDIR/vendor and can't find any modules... This fix is not right - it allows zftool to ignore the fact that baseDir is set for APPDIR/vendor and then it silently fails because no modules are visible. |
my bad i didn't provide a solution, last time i've just added 1 more dirname() and forget about it. right now i don't use zend right now, so my vision for fix is virtual so, I see we may replace this part of code (from line 14 zf.php)
with this
as for me, it is easier to get vision of the logic regards |
Yes can this be reopened still not work |
Hi.. I am still facing the same issue after downloading latest zftool. Is this already fixed? |
I had to create a symlink of vendor/bin/zf.php into my application folder, and then call "php zf.php" from there, to have it work properly. A fix would be welcome. |
Yes, doesn't work for me either through composer. Changed |
Still not working ... |
Yurii's code worked for me after I removed the $ from the $basePath = __DIR__;
try {
$base_dirs = array(__DIR__, dirname(dirname(__DIR__)), dirname(dirname(dirname(__DIR__)))); //possible dirs
$files = array("vendor/autoload.php", "init_autoloader.php", "autoload.php", ); //possible autoload files
$exists = false;
foreach($base_dirs as $bd) {
foreach($files as $f) {
if (file_exists($bd . "/$f")) {
chdir($bd); //fallback
$basePath = $bd;
require_once $bd . "/$f";
$exists = true;
break 2;
}
}
}
if(!$exists) {
throw new Exception('Error: I cannot find the autoloader of the application.' . PHP_EOL . "Check if $basePath contains a valid ZF2 application." . PHP_EOL ,2);
}
} catch (Exception $e) {
echo $e->getMessage();
exit($e->getCode());
} |
I update zf.php as follows
|
The zf.php should be installed into the vendor/ZFTool directory (relative to your project root) - however, the command needs to be run from your project root in order for it to work correctly. http://framework.zend.com/manual/2.3/en/modules/zendtool.introduction.html |
Just run ZF from root dir:
|
when installed with composer you get error
" Error: I cannot find the autoloader of the application. "
This is because of subdirectory of zendframework. It can be resovled by adding 1 dirname to zf.php (line 17) :
$basePath = dirname(dirname(dirname($basePath)));
regards
The text was updated successfully, but these errors were encountered: