Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

Error including "index.php" even when "web" is set to false. #39

Closed
taylorotwell opened this issue May 9, 2013 · 14 comments
Closed

Error including "index.php" even when "web" is set to false. #39

taylorotwell opened this issue May 9, 2013 · 14 comments

Comments

@taylorotwell
Copy link

I'm on the latest build of Box 2.0. I tried basically started with the box.json.dist file that ships with Box when making my own box file, which looks like this:

{
    "alias": "craft.phar",
    "chmod": "0755",
    "directories": ["src/lib"],
    "finder": [
        {
            "name": "*.php",
            "exclude": [
                "phpunit",
                "phpunit-test-case",
                "Tester",
                "Tests",
                "tests",
                "yaml"
            ],
            "in": "src/vendors"
        }
    ],
    "main": "bin/craft",
    "output": "craft.phar",
    "stub": true
}

However, I am getting an error that the index.php doesn't exist when actually trying to run the generated Phar. So, I cloned down Box itself and ran box build and get the same error on a clean clone of Box:

Warning: include(phar:///media/sf_Code/Laboratory/Box/box-2.0.0-rc.1-8-g77f3c19.phar/index.php):
@ghost ghost self-assigned this May 9, 2013
@ghost
Copy link

ghost commented May 9, 2013

Unfortunately, I am not able to reproduce the error:

kherrera@u1304d:~/Projects/Box$ git describe --tags HEAD
2.0.0-rc.1-8-g77f3c19
kherrera@u1304d:~/Projects/Box$ bin/box build
Building...
kherrera@u1304d:~/Projects/Box$ ./box-2.0.0-rc.1-8-g77f3c19.phar 
Box version 2.0.0-rc.1-8-g77f3c19

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v Increase verbosity of messages.
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  add           Adds or replaces files to a Phar.
  build         Builds a new Phar.
  extract       Extracts files from a Phar.
  help          Displays help for a command
  info          Displays information about the Phar extension or file.
  list          Lists commands
  remove        Removes files from a Phar.
  update        Updates the application.
  validate      Validates the configuration file.
  verify        Verifies the Phar signature.
key
  key:create    Creates a private key
  key:extract   Extracts the public key from a private key.
kherrera@u1304d:~/Projects/Box$ 

I cloned it again from GitHub for good measure, but I still did not get that error message (although I did find a different one, not relevant to this issue).

Would it be possible for you to send me the broken Box Phar you built?

@taylorotwell
Copy link
Author

@ghost
Copy link

ghost commented May 9, 2013

It looks like the default PHP Phar stub is used, and not the one generated by Box.

Could you please provide the following?

  1. The output of box --version.
  2. The output of box build --verbose.

I am trying to figure out if you are using Box 1.0 to build Box 2.0, and if the "stub" setting in the configuration file is being respected. I am sort of stumped at the moment and am looking for clues.

@taylorotwell
Copy link
Author

I'm getting a new error when building that I'm not sure is related to your latest commit or not. I pulled a fresh copy of the Box repo to build.

Box Version:

taylor@ubuntu:/media/sf_Code/Laboratory/Box$ box --version
Box version 2.0.0-rc.1

Verbose Build:

taylor@ubuntu:/media/sf_Code/Laboratory/Box$ box build --verbose
? Removing previously built Phar...
* Building...
? Output path: /media/sf_Code/Laboratory/Box/box-2.0.0-rc.1-9-g3548aa1.phar
? Setting replacement values...
  + @manifest_url@: http://box-project.org/manifest.json
  + @git_tag@: 2.0.0-rc.1-9-g3548aa1
? Registering compactors...
  + Herrera\Box\Compactor\Json
  + Herrera\Box\Compactor\Php
? Adding files...
  + /media/sf_Code/Laboratory/Box/LICENSE
  + /media/sf_Code/Laboratory/Box/res/schema.json
  + /media/sf_Code/Laboratory/Box/src/vendors/herrera-io/phar-update/res/schema.json



  [Herrera\Box\Exception\FileException]
  The file "/media/sf_Code/Laboratory/Box/src/vendors/herrera-io/phar-update/
  res/schema.json" does not exist or is not a file.



Exception trace:
 () at phar:///usr/local/bin/box/src/vendors/herrera-io/box/src/lib/Herrera/Box/Exception/Exception.php:26
 Herrera\Box\Exception\Exception::create() at phar:///usr/local/bin/box/src/vendors/herrera-io/box/src/lib/Herrera/Box/Box.php:97
 Herrera\Box\Box->addFile() at phar:///usr/local/bin/box/src/lib/KevinGH/Box/Command/Build.php:479
 KevinGH\Box\Command\Build->add() at phar:///usr/local/bin/box/src/lib/KevinGH/Box/Command/Build.php:319
 KevinGH\Box\Command\Build->execute() at phar:///usr/local/bin/box/src/vendors/symfony/console/Symfony/Component/Console/Command/Command.php:240
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/box/src/vendors/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/box/src/vendors/symfony/console/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/box/bin/box:17
 require() at /usr/local/bin/box:10


build [-c|--configuration="..."]

@taylorotwell
Copy link
Author

Interesting to note that the "index.php" error is not happening on Mac, though I still get that schema.json error I posted above when trying to build Box itself.

So, it only appears to be happening on my Ubuntu 12.10 VM.

@ghost
Copy link

ghost commented May 9, 2013

Is the Mac the host?

@taylorotwell
Copy link
Author

Yes, the Mac is the host.

@ghost
Copy link

ghost commented May 9, 2013

Unfortunately all I could setup was a Ubuntu VM with a Windows host.

I was still not able to replicate the issue using a shared folder.

If you clone and build Box using the VM's FS and not the shared folder, do you still get errors?

@taylorotwell
Copy link
Author

Aha! Yes, I can build my project successfully outside of the shared directory.

@ghost
Copy link

ghost commented May 9, 2013

Could you please try using Box (current commit) on the project in the shared folder again?

I added a check for read permission, thinking it might have something to do with that.

Aside from that, I am not sure there is much more I can do, shared folders are a very special case.

@taylorotwell
Copy link
Author

Sorry for the delay. Tried it and that didn't seem to make a difference. Honestly I don't particularly care anymore as I can just build outside of the shared folder, so I'll go ahead and close this. Thanks!

@dlancea
Copy link

dlancea commented Jul 16, 2013

I'm getting this same error. I'm on windows using the newest version of Box (Box version 2.1.0 build 963db3f)

Here's my box.json, mostly copied from Box's box.json.dist:

{
    "chmod": "0755",
    "compactors": [
        "Herrera\\Box\\Compactor\\Json",
        "Herrera\\Box\\Compactor\\Php"
    ],
    "directories": ["src/"],
    "finder": [
        {
            "name": "*.php",
            "exclude": [
                "Tests",
                "tests",
                "test-suite",
                "doc",
            ],
            "in": "vendor/"
        }
    ],
    "files": [
        "console.php"
    ],
    "main": "console.php",
    "output": "jira-reports.phar",
    "web": false
}

But the start of the built .phar file still requests index.php and initializes webPhar:

<?php
$web = 'index.php';

if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
Phar::webPhar(null, $web);
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
return;
}
...

@ghost
Copy link

ghost commented Jul 16, 2013

Try adding the "stub": true setting to your configuration.

This will tell Box to generate its own stub, instead of using the default stub provided by Phar.

@dlancea
Copy link

dlancea commented Jul 16, 2013

Whoops, I just caught that. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants