GithubHelp home page GithubHelp logo

Comments (21)

lubyshev avatar lubyshev commented on July 19, 2024 2

Just run ZF from root dir:

$ php ./vendor/zendframework/zftool/zf.php modules list

from zftool.

ezimuel avatar ezimuel commented on July 19, 2024

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.

mtcocktail avatar mtcocktail commented on July 19, 2024

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.

Lohoris avatar Lohoris commented on July 19, 2024

I have encountered the same error, and that fix didn't work for me.

from zftool.

gabel avatar gabel commented on July 19, 2024

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.

jhogendorn avatar jhogendorn commented on July 19, 2024

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.

glen-84 avatar glen-84 commented on July 19, 2024

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.

noose avatar noose commented on July 19, 2024

Please Ignore commit a27e238 ;-)

from zftool.

webzellent avatar webzellent commented on July 19, 2024

Thank you :-)

from zftool.

MarcusReimann avatar MarcusReimann commented on July 19, 2024

The solution from noose is correct.

from zftool.

ezimuel avatar ezimuel commented on July 19, 2024

I merged the PR #31 that seems to fix the issue.

from zftool.

pawlik avatar pawlik commented on July 19, 2024

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.

yurii-github avatar yurii-github commented on July 19, 2024

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.

cdekok avatar cdekok commented on July 19, 2024

Yes can this be reopened still not work

from zftool.

tapankumar avatar tapankumar commented on July 19, 2024

Hi..

I am still facing the same issue after downloading latest zftool.

Is this already fixed?

from zftool.

ericmorand avatar ericmorand commented on July 19, 2024

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.

robbestad avatar robbestad commented on July 19, 2024

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.

tasmaniski avatar tasmaniski commented on July 19, 2024

Still not working ...
(^ even with the above solution)

from zftool.

altdprogrammer avatar altdprogrammer commented on July 19, 2024

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.

speermahi avatar speermahi commented on July 19, 2024

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.

freeentr avatar freeentr commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.