Coder Social home page Coder Social logo

Comments (12)

MaxGfeller avatar MaxGfeller commented on August 16, 2024 2

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 [email protected]

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
.

from pico.

MaxGfeller avatar MaxGfeller commented on August 16, 2024

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 [email protected]

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 [email protected]

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
.

from pico.

chrisalbon avatar chrisalbon commented on August 16, 2024

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 <[email protected] (mailto:[email protected])>

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)).

from pico.

MaxGfeller avatar MaxGfeller commented on August 16, 2024

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.

from pico.

abely avatar abely commented on August 16, 2024

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.

from pico.

MaxGfeller avatar MaxGfeller commented on August 16, 2024

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

from pico.

abely avatar abely commented on August 16, 2024

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?

from pico.

abely avatar abely commented on August 16, 2024

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!

from pico.

jduerr avatar jduerr commented on August 16, 2024

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.

from pico.

cwiggs avatar cwiggs commented on August 16, 2024

@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.

from pico.

ChamodyaDias avatar ChamodyaDias commented on August 16, 2024

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

from pico.

PhrozenByte avatar PhrozenByte commented on August 16, 2024

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.

from pico.

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.