Comments (21)
Just run ZF from root dir:
$ php ./vendor/zendframework/zftool/zf.php modules list
from zftool.
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.
from zftool.
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
Error: I cannot find the autoloader of the application.
from zftool.
I have encountered the same error, and that fix didn't work for me.
from zftool.
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.
- not working (default directory via composer installation)
vendor/zendframework/zftool - working
vendor/zftool
{
"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"
}
}
from zftool.
Heya, am I correct in following that this is still not resolved?
It's certainly still the case with my own zftool install.
from zftool.
Same issue for me, and I can't seem to create the phar either:
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(***\zf2-tutorial\vendor\zftool/vendor,***\zf2-tutorial\vendor\zftool/vendor): The system cannot find the file specified. (code: 2)' in ***\zf2-tutorial\vendor\zftool\bin\create-phar on line 65
UnexpectedValueException: RecursiveDirectoryIterator::__construct(***\zf2-tutorial\vendor\zftool/vendor,***\zf2-tutorial\vendor\zftool/vendor): The system cannot find the file specified. (code: 2) in ***\zf2-tutorial\vendor\zftool\bin\create-phar on line 65
Call Stack:
0.0004 135816 1. {main}() ***\zf2-tutorial\vendor\zftool\bin\create-phar:0
0.0134 148224 2. addDir() ***\zf2-tutorial\vendor\zftool\bin\create-phar:26
0.0134 148896 3. RecursiveDirectoryIterator->__construct() ***\zf2-tutorial\vendor\zftool\bin\create-phar:65
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(***\zf2-tutorial\vendor\zftool/vendor,***\zf2-tutorial\vendor\zftool/vendor): The system cannot find the file specified. (code: 2)' in ***\zf2-tutorial\vendor\zftool\bin\create-phar:65
Stack trace:
#0 ***\zf2-tutorial\vendor\zftool\bin\create-phar(65): RecursiveDirectoryIterator->__construct('D:\Programming\...')
#1 ***\zf2-tutorial\vendor\zftool\bin\create-phar(26): addDir(Object(Phar), 'D:\Programming\...', 'D:\Programming\...')
#2 {main}
thrown in ***\zf2-tutorial\vendor\zftool\bin\create-phar on line 65
from zftool.
Please Ignore commit a27e238 ;-)
from zftool.
Thank you :-)
from zftool.
The solution from noose is correct.
from zftool.
I merged the PR #31 that seems to fix the issue.
from zftool.
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.
from zftool.
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)
$basePath = __DIR__;
if (file_exists("$basePath/vendor/autoload.php")) {
require_once "$basePath/vendor/autoload.php";
} else {
$basePath = dirname(dirname($basePath));
chdir($basePath);
if (file_exists("init_autoloader.php")) {
require_once "init_autoloader.php";
} elseif (file_exists("vendor/autoload.php")) {
require_once "vendor/autoload.php";
} elseif (file_exists("autoload.php")) {
require_once "autoload.php";
} else {
echo 'Error: I cannot find the autoloader of the application.' . PHP_EOL;
echo "Check if $basePath contains a valid ZF2 application." . PHP_EOL;
exit(2);
}
}
with this
$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());
}
as for me, it is easier to get vision of the logic
regards
from zftool.
Yes can this be reopened still not work
from zftool.
Hi..
I am still facing the same issue after downloading latest zftool.
Is this already fixed?
from zftool.
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.
from zftool.
Yes, doesn't work for me either through composer. Changed
$basePath=getcwd(); to $basePath=getcwd()."/../../../"; to get it working. Of course, that assumes zftools is in vendor/zendframework/zftool
from zftool.
Still not working ...
(^ even with the above solution)
from zftool.
Yurii's code worked for me after I removed the $ from the __DIR__
. Modified code is as follows
$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());
}
from zftool.
I update zf.php as follows
$basePath = getcwd(); -> points to vendor/bin folder
ini_set('user_agent', 'ZFTool - Zend Framework 2 command line tool');
// load autoloader -> swap $basePath with "../../"
if (file_exists("../../vendor/autoload.php")) {
require_once "../../vendor/autoload.php";
} elseif (file_exists("../../init_autoload.php")) { // swap $basePath with "../../"
require_once "../../init_autoload.php";
from zftool.
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
from zftool.
Related Issues (20)
- No namespace in module config file after creation
- zftool.phar: command not found HOT 3
- Can't install using composer HOT 7
- Create action doesn't work HOT 2
- Enable Travis-ci service HOT 2
- Enable phpcs
- Add documentation about json response in diagnostics
- Controller creation fails when directory is missing
- Error on display config list HOT 2
- create Action fails when using project path
- ZFTool keeps saying it has thrown an exception when no exception is listed. HOT 2
- Create classmap on Windows OS HOT 2
- Zend 3 compatible? HOT 8
- zf.php version not showing version
- unable to find download link of zftool.phar HOT 1
- fail run zftool after phar create HOT 3
- zftool config list seems to be executing MVC code...
- What is the license of this project? HOT 2
- Error install composer HOT 8
- Default loading page does not load Zend framework 3 .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zftool.