Class 'Image' not found in laravel 4 - php

I downloaded a website developed on laravel4 on my system and runing it on my localhost . Some of the pages are not working .
When I am trying to upload an Image . following error is occurring.
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
HELP
Class 'Image' not found
So I googled and got to know that I will have to add the intervention/image in my coomposer.json file i changed the code of json array from
"require": {
"laravel/framework": "4.2.*",
"intervention/image": "1*"
},
to
"require": {
"laravel/framework": "4.2.*",
"intervention/image": ""2.3.0""
},
Then I did composer update and I am getting following error
Any leads ??
C:\Users\User\Desktop\ideconnect>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for intervention/image 2.3.0 -> satisfiable by interv
ention/image[2.3.0].
- intervention/image 2.3.0 requires ext-fileinfo * -> the requested PHP exte
nsion fileinfo is missing from your system.
Thanks

The error you're getting is fairly clear:
the requested PHP extension fileinfo is missing from your system.
This means that the package you are trying to install relies on a PHP extension that your specific PHP installation does not have. This is fixable, but might be specific to your environment.
The first thing to do would be to check your php.ini and see if the extension is simply commented out. If you are using Windows, it might look like this inside php.ini:
;extension=php_fileinfo.dll
you should uncomment it like so:
extension=php_fileinfo.dll
After doing this you will need to restart your webserver.
If that doesn't work, you will need to look for more info in the PHP manual: http://php.net/manual/en/fileinfo.installation.php

Related

Composer update error on friendsofsymfony/http-cache-bundle

i wanted to install the following packages for the Symfony Framework 3.4 with help of the composer package manager:
friendsofsymfony/http-cache-bundle
guzzlehttp/psr8
php-http/guzzle6-adapter
I dont have much experience with composer. I saw that those packages are installable under Symfony 3.4 in a tutorial. I even tried installing every component of the bundle one by one, quitting with the bellow error message for example (guzzlehttp/psr7). When installations failed why are the packages then in my composer.json file under require ?
Here is my composer.json:
"require": {
"php": ">=7.1.3",
"friendsofsymfony/http-cache": "^2.5.2",
"friendsofsymfony/http-cache-bundle": "^2.6",
"guzzlehttp/psr7": "^1.5",
"php-http/guzzle6-adapter": "^2.0",
I am getting this error message:
Errror message
Error message installing (guzzlehttp/psr7):
Errror message
Thanks in advance.
You executed composer update, so probably you have added packages manually in the composer.json
composer update won't change what is inside composer.json.
upgrade: Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
See https://getcomposer.org/doc/01-basic-usage.md for mroe details.
Shortcut for "add if possible" is the command composer require
Exmaple:
composer require friendsofsymfony/http-cache
This will try to install the package. composer.* files will be updated only on successful installation.

ext-imagick * -> the requested PHP extension imagick is missing from your system

I have trouble installing devisephp for laravel. I am working on the latest version of homestead with php7. when i do composer update i get the following error.
Problem 1
- Installation request for devisephp/cms 1.4.* -> satisfiable by devisephp/cms[1.4.0].
- devisephp/cms 1.4.0 requires ext-imagick * -> the requested PHP extension imagick is missing from your system.
After having this message i installed imagick on my homestead environment added the extension to php.ini in cli and fpm and checked in homestead if imagick is working with a test file. Everything was working perfectly but on running composer update i still get the same error message from above. Does anyone have a clue what the problem can be.
The stange thing is that is kan git clone devisephp its bootstrap version completely working including image handling but when i add another package to laravel i again get the above message.
if you really can't install or don't want that extension to be validated you may skip it by supplying the
--ignore-platform-reqs
flag to your composer command
Please follow these steps
sudo apt-get install php-imagick
php -m | grep imagick // this should print 'imagick' it means installed correctly
sudo service apache2 restart //(if needed)
Try adding:
"ext-imagick": "*",
to your require block in your composer.json like so:
"license": "MIT",
"require": {
"ext-imagick": "*",
....
}
and run composer update
With the config.platform key in composer.js you can fake dependencies like php versions or extensions (you can't use an asterisk for the extension version, though!)
https://getcomposer.org/doc/06-config.md#platform
As a bonus, you can polyfill ext-imagick with this library: https://github.com/calcinai/php-imagick. it's not complete and relies on the command line ImageMagick. So far it works for me.
{
"require": {
"calcinai/php-imagick": "dev-master"
},
"config": {
"platform":{
"ext-imagick": "3.4.4"
}
}
}

Deploy PHP application with extension mongo into heroku 2015

I've just deployed php application into heroku with extension mongo db.
In previous (11/2014), it's ok.
But currently I received error messsage: The requested php extension ext-mongo * is missing from your system.
Here is the structure of project on github (using to deploy into heroku):
Root
php.ini
composer.json
composer.lock
Procfile
MySources
ext
mongo.so (this file is located inside ext folder).
php.ini:
extension_dir="/app/ext/"
extension=mongo.so
composer.json:
{
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"ext-mongo": "*"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
Procfile:
web: vendor/bin/heroku-php-apache2
Any one can help me to configure or sugguest me to resolve this problem? Deploy with the lasted heroku and php 5.6.7.
You don't need the ext folder (because the extension is already available on Heroku), and you don't need the php.ini, which doesn't have any effect anyway, because you're not configuring Heroku to use it.
You need to run composer update so the ext-mongo requirement gets "frozen" to composer.lock.
If you don't have that extension installed locally on your system, then you should install it (along with a MongoDB server), because you really want to test your code locally before you blindly push it up to Heroku to see whether it works or not.
If, for any reason, you can't do that, a composer update --ignore-platform-reqs will prevent "The requested php extension ext-mongo * is missing from your system" to happen on your local machine, and generate the correct composer.lock even if the extension is missing.
This is, by the way, all clearly documented here: https://devcenter.heroku.com/articles/php-support#extensions

Symfony2 install phpDocumentor

I want to install phpdocumentor to my Symfony 2.4 project, so I added this two lines to my composer.json:
"require": {
//my old requires
"phpdocumentor/template-abstract": "~1.2",
"phpdocumentor/phpdocumentor": "2.1.*#dev"
}
whene I execut php composer.phar update, i have these errors:
Problem 1
- phpdocumentor/template-abstract 1.2.1 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
- phpdocumentor/template-abstract 1.2 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
- Installation request for phpdocumentor/template-abstract ~1.2 -> satisfiable by phpdocumentor/template-abstract[1.2, 1.2.1].
although I installed php_xsl in my php extensions?!!
Thank you.
Ok I just answered this here.. might as well elucidate.
Basically you also need to enable the extension in the php.ini file used by PHP CLI as this is the one composer uses when you run it on the command line.
( Mine is at: C:\wamp\bin\php\php5.4.12\php.ini )
Good Luck.
#Mohamed: I was getting the same problem few days back but when I tried the following command it then worked successfully.This will update your composer.phar file.
php composer.phar self-update

Problems with Avalanche-imagine in symfony2

I'm trying to create thumbnails with Avalanche-imagine bundle. I'm using OS X 10.7 Lion and MAMP PRO as Apache server.
When I call the filter in the twig file, I get a 500 error.
Here I put the path manually to check it:
<img src='{{'store/images/Pictures/P1000665.JPG' | apply_filter('my_thumb')}}'>
And I get this message:
GET
http://taller:8888/web/app_dev.php/media/cache/my_thumb/store/images/Pictures/P1000665.JPG 500
(Internal Server Error)
line 35, it's strange because my thumbnails are used far behind
I installed the bundle following this instructions: https://github.com/avalanche123/AvalancheImagineBundle
I have to say that I had several problems installing it because composer.phar gave me an error message:
"Problem 1
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for symfony/icu 1.2.* -> satisfiable by symfony/icu[v1.2.0]."
I solved it adding this line in the composer.json requirements:
"symfony/icu": "1.0.*",
Once installed, I could install the AvalancheImageBundle with the composer.
Then I changed AppKernel as they said in the instruction with this line:
new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),
but I didn't change the autoload file, as I had to do when I installed FOSUserBundle. Do I have to add anything there?
I tried with this, but it didn't solved my problem:
$loader->add('imagine', __DIR__.'/../vendor/imagine/imagine/lib');
$loader->add('Avalanche123', __DIR__.'/../vendor'):
Additional info:
My proyect is in: Symfony2/proyecto/taller/here_are_web_app_vendor_and_src
My apache server aim to: Symfony2/proyecto/taller using the sortcut taller instead of localhost my url is like this:
http://taller:8888/web/app_dev.php/
My pictures are in the url: Symfony2/proyecto/taller/web/store/images/Pictures/test.jpg
witch url should I give to the filter? I think it is store/images/Pictures/test.jpg
The problem could be in the dependences of the bundle, because I put that line the composer.json?
Maybe should I write something in the autoload file? Any reference to vendor/imagine miss?
Also I tried to install liipImagine bundle, but I couldn't because it said that I had installed imagine 0.3.0 and I needed imagine 0.4.0. How can I uninstall imagine and install the new version to run liipimaginebudle?
appKernel:
As you can see, no references to imagine (I guess its integer in Avalanchebundle)
autoload:
(no references to avalanche?)
Here is where my pictures are located and you can see how Avalanche created the media folder:
This is my vendor file:
I don't know where is the problem, this is why I put so many information.
I solved the problem using LiipImagineBundle.
To install it first I deleted Avalanche reference in composer.json and everything else I wrote in appKernel.php, etc.
Then I did composer.phar update and it deleted also imagine/imagine 0.3.0 vendor library. Finally I installed LiipImagine via composer normally that installed a newer version of imagine/imagine, 0.4.0.

Categories