Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed opening required '__DIR__/composer/autoload_real.php #65

Closed
chrisalbon opened this issue Aug 18, 2013 · 12 comments
Closed

Failed opening required '__DIR__/composer/autoload_real.php #65

chrisalbon opened this issue Aug 18, 2013 · 12 comments

Comments

@chrisalbon
Copy link

chrisalbon commented Aug 18, 2013

#edit by @PhrozenByte:

You likely got here by chance because it's the first Google result for the error message shown below. Welcome to the GitHub repository of Pico, a stupidly simple, blazing fast, flat file CMS! Even if you don't use Pico, we want to help you. Just refer to last comment of this Issue below to get some general info about the problem you experience: #65 (comment)


I uploaded Pico but I only see a blank php page of death. After turning on error reporting, I get this:

Notice: Use of undefined constant DIR - assumed 'DIR' in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5 Warning: require_once(DIR/composer/autoload_real.php): failed to open stream: No such file or directory in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5 Fatal error: require_once(): Failed opening required 'DIR/composer/autoload_real.php' (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5

I figured I had the wrong version of PHP, but I just checked and am running 5.2.10. Any ideas?

Here is my phpinfo: http://www.writemorefaster.com/test.php

@MaxGfeller
Copy link

You have to have PHP 5.3 installed to use the "DIR" magic constant:
http://php.net/manual/en/language.constants.predefined.php

To preserve compability with PHP 5.2 the developers would have to replace
"DIR" with dirname(__FILE__)

2013/8/18 Chris R. Albon notifications@github.com

I uploaded Pico but I only see a blank php page of death. After turning on
error reporting, I get this:

Notice: Use of undefined constant DIR - assumed 'DIR' in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on
line 5 Warning: require_once(DIR/composer/autoload_real.php): failed to
open stream: No such file or directory in /hsphere/local/home/livenoma/
writemorefaster.com/vendor/autoload.php on line 5 Fatal error:
require_once(): Failed opening required
'DIR/composer/autoload_real.php'
(include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on
line 5

I figured I had the wrong version of PHP, but I just checked and am
running 5.2.10. Any ideas?

Here is my phpinfo: http://www.writemorefaster.com/test.php


Reply to this email directly or view it on GitHubhttps://github.com//issues/65
.

@MaxGfeller
Copy link

Oh - it seems to be a composer problem. Since composer does not work with
5.2 it should be noted on the Pico home page somewhere.

2013/8/19 Max Gfeller max.gfeller@gmail.com

You have to have PHP 5.3 installed to use the "DIR" magic constant:
http://php.net/manual/en/language.constants.predefined.php

To preserve compability with PHP 5.2 the developers would have to replace
"DIR" with dirname(__FILE__)

2013/8/18 Chris R. Albon notifications@github.com

I uploaded Pico but I only see a blank php page of death. After turning on

error reporting, I get this:

Notice: Use of undefined constant DIR - assumed 'DIR' in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on
line 5 Warning: require_once(DIR/composer/autoload_real.php): failed to
open stream: No such file or directory in /hsphere/local/home/livenoma/
writemorefaster.com/vendor/autoload.php on line 5 Fatal error:
require_once(): Failed opening required
'DIR/composer/autoload_real.php'
(include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on
line 5

I figured I had the wrong version of PHP, but I just checked and am
running 5.2.10. Any ideas?

Here is my phpinfo: http://www.writemorefaster.com/test.php


Reply to this email directly or view it on GitHubhttps://github.com//issues/65
.

@chrisalbon
Copy link
Author

Ah, that makes sense. The specs on the website need updating then, they claim Pico only requires 5.2.4+

On Monday, August 19, 2013 at 9:56 AM, Max Gfeller wrote:

You have to have PHP 5.3 installed to use the "DIR" magic constant:
http://php.net/manual/en/language.constants.predefined.php

To preserve compability with PHP 5.2 the developers would have to replace
"DIR" with dirname(__FILE__)

2013/8/18 Chris R. Albon <notifications@github.com (mailto:notifications@github.com)>

I uploaded Pico but I only see a blank php page of death. After turning on
error reporting, I get this:

Notice: Use of undefined constant DIR - assumed 'DIR' in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php (http://writemorefaster.com/vendor/autoload.php) on
line 5 Warning: require_once(DIR/composer/autoload_real.php): failed to
open stream: No such file or directory in /hsphere/local/home/livenoma/
writemorefaster.com/vendor/autoload.php (http://writemorefaster.com/vendor/autoload.php) on line 5 Fatal error:
require_once(): Failed opening required
'DIR/composer/autoload_real.php'
(include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in
/hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php (http://writemorefaster.com/vendor/autoload.php) on
line 5

I figured I had the wrong version of PHP, but I just checked and am
running 5.2.10. Any ideas?

Here is my phpinfo: http://www.writemorefaster.com/test.php


Reply to this email directly or view it on GitHubhttps://github.com//issues/65
.


Reply to this email directly or view it on GitHub (#65 (comment)).

@MaxGfeller
Copy link

But since the whole vendor directory is checked in directly in the Pico project, the end user does not need to run composer itself (which requires PHP 5.3). So if you would only update the AutoloadGenerator from composer, that would work in my opinion: https://github.com/composer/composer/blob/master/src/Composer/Autoload/AutoloadGenerator.php

So only Pico developers needed to have PHP 5.3 while the users still could use 5.2. But i don't know if the guys behind composer would merge that in.

@abely
Copy link

abely commented Dec 19, 2013

Is there a way to workaround the issue? My web host only has PHP version 5.2.17, and I am not a pico developer.

@MaxGfeller
Copy link

You could edit the vendor/autoload.php file manually and replace __DIR__ with dirname(__FILE__)

@abely
Copy link

abely commented Dec 20, 2013

Then I get

[19-Dec-2013 18:00:35] PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in /home2/insweatc/public_html/pico/vendor/composer/autoload_real.php on line 23
[19-Dec-2013 18:00:35] PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in /home2/insweatc/public_html/pico/vendor/composer/autoload_real.php on line 23
[19-Dec-2013 18:00:35] PHP Parse error:  syntax error, unexpected T_STRING in /home2/insweatc/public_html/pico/vendor/composer/autoload_real.php on line 23

and my autoload_real.php looks like this:

<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit68d29614b81b64051229769b084d96b6
{
    private static $loader;

    public static function loadClassLoader($class)
    {
        if ('Composer\Autoload\ClassLoader' === $class) {
            require __DIR__ . '/ClassLoader.php';
        }
    }

    public static function getLoader()
    {
        if (null !== self::$loader) {
            return self::$loader;
        }

        spl_autoload_register(array('ComposerAutoloaderInit68d29614b81b64051229769b084d96b6', 'loadClassLoader'), true, true);
        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
        spl_autoload_unregister(array('ComposerAutoloaderInit68d29614b81b64051229769b084d96b6', 'loadClassLoader'));

        $vendorDir = dirname(__DIR__);
        $baseDir = dirname($vendorDir);

        $map = require __DIR__ . '/autoload_namespaces.php';
        foreach ($map as $namespace => $path) {
            $loader->set($namespace, $path);
        }

        $classMap = require __DIR__ . '/autoload_classmap.php';
        if ($classMap) {
            $loader->addClassMap($classMap);
        }

        $loader->register(true);

        return $loader;
    }
}

Any idea?

@abely
Copy link

abely commented Dec 20, 2013

I just found PHP 5.3 could be enabled on my host, and it is no longer an issue for me. Thanks all the same!

@jduerr
Copy link

jduerr commented Jan 8, 2015

Did anyone figure out how to get pico running on PHP 5.2?
I'd love to set pico up on our NAS. But an update to php 5.3 is available for that old box, sadly.
Already tried using MaxGfellers tip - get the Unexpected character in input warning like abely.

@cwiggs
Copy link

cwiggs commented Apr 14, 2016

@jduerr FYI in case anyone else has this problem. I was having a problem with this with Dokuwiki, and found my way here. To fix that I just installed an older version of Dokuwiki. That same fix might work with Pico.

@ChamodyaDias
Copy link

running "composer update" command worked for me.(windows)

@PhrozenByte
Copy link
Collaborator

PhrozenByte commented Nov 26, 2018

It's kinda weird that this Issue is actually the first Google result for this error message, even though Pico users won't experience it. Anyway, it's nevertheless a good idea to help all non-Pico users who seek help.

Welcome to the GitHub repository of Pico, a stupidly simple, blazing fast, flat file CMS. Even though you're here by chance, we might offer you a great alternative. Visit us at http://picocms.org/ and see http://picocms.org/about/ for more info. 👍

Depending on the actual error message you experience, the solution differs:

Notice: Use of undefined constant DIR - assumed 'DIR' in /var/www/html/…

Unfortunately I've to tell you that you can't run this application on your webserver 😞 To be more presice, you shouldn't run any application on your webserver. Your webserver runs a desperately outdated version of PHP (PHP 5.2 or earlier) that didn't receive any security updates since January 2011:exclamation:

Naturally nobody can't prevent you from doing it anyway. What will prevent you from doing it is the fact, that the application you're trying to install won't run on this outdated version of PHP and requires a newer PHP version. You will likely find the required PHP version in the application's README.md or install instructions.

There's no other solution than updating your PHP version.

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/…

Please check your application's install instructions (maybe in its README.md), it looks like just uploading all of the application's files to your webserver isn't enough and you've to go through some more steps. Likely you'll have to open a shell, navigate to the desired install directory of the application and run composer install.

However, you really should check the application's install instructions 😉

Cannot find 'vendor/autoload.php'. Run `composer install`.

It looks like you're a Pico user and got lost 😃 You likely downloaded a Source code archive instead of one of Pico's release archives by accident. Just refer to Pico's install instructions and download the pico-release-[version].tar.gz archive instead of one of the Source code archives.

If Pico won't run nevertheless, you can join us on #picocms on Libera.Chat to get help. Alternatively, please don’t hesitate to create a new Issue on GitHub. Also see the "Getting help" section in Pico's docs.

Repository owner locked and limited conversation to collaborators Nov 26, 2018
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

8 participants