failed to install imagine class with require(vendor/autoload.php error on centos6.5/php5.4

1.2k Views Asked by At

I know many users have asked same question before but it wasn't helpful for me... I have a VPS (centOS6.5/directadmin/php5.4/SSH terminal)

I try install imagine (https://imagine.readthedocs.org) class in my server via getcomposer.org

These are my all steps:

First I install getcomposer:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

then:

cd /usr/local/bin/

And

   echo '{"require": {"imagine/imagine": "~0.6.2"}}'->composer.json

After That I run it:

composer update

OK! everything seems installed!

Now in my website root, I want to test it:

<?php
require 'vendor/autoload.php'; // line 2
$imagine = new Imagine\Gd\Imagine();   // line 3



?>

But I get this error:

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /home/admin/domains/example.com/public_html/info.php on line 2

Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/local/php54/lib/php') in /home/admin/domains/example.com/public_html/info.php on line 2

//EDIT

The real locate of autoload.php in my server:

/usr/local/bin/vendor/autoload.php

Also There "imagine" directory in vendor directory!

2

There are 2 best solutions below

0
On

/usr/local/bin is where your binary files live. You should move composer.phar to this location (and rename it to composer) and then use composer in your command line.

The composer.json file is part of your package, it specifies the packages it depends on in this file. You then can install all required packages for the current package by using composer install/composer update. This will make a vendor directory with all third party code and a preconfigured autoloader in vendor/autoload.php.

0
On

Finaly after install imagine class, I moved the composer to root of my website and now it works normally