Installing PECL library on heroku - php

Can anyone suggest a way to install a custom PECL library on Heroku instance?
I have tried to include it via composer.json file, but following error is produced:
- composer.json/composer.lock requires ext-yaml * -> no matching package found.

Related

php dependency/package manager Composer will not install packages

I'm building a website with PHP framework "Slim" as my templating framework, and it recommends using composer as the package manager. SO... I'm now using composer for the first time, developing locally on 64 bit Ubuntu 16.04 and composer is not installing anything into my project.
I've followed the installation instructions on the Slim Framework & Composer websites to a tee.
Basically this is the order of what I've done:
Installed composer into /var/www/html directory [1.]
Created Slim project using Slim-Skeleton as a base
php composer.phar create-project slim/slim-skeleton slimLittleTest
Note: the php composer.phar create-project slim/slim-skeleton command automatically creates a composer.json file, I will put the contents of that file down farther in my question.
Change into that directory and run php composer.phar install
Nothing is installed!
If I try to run php -S localhost:8080 -t public public/index.php as you're now supposed to able to (from the Slim framework website homepage tutorial) I get the following error:
[Tue Sep 5 18:55:04 2017] PHP Fatal error: require(): Failed opening required '/var/www/html/slimLittleTest/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/slimLittleTest/public/index.php on line 12
[Tue Sep 5 18:55:05 2017] PHP Warning:
require(/var/www/html/slimLittleTest/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/slimLittleTest/public/index.php on line 12
This error of course makes sense because nothing got installed! There is no vendor/autoload.php because Composer hasn't installed anything. (By default Composer installs dependencies into the vendor folder in the root of your project)
SEPTEMBER 7th QUESTION UPDATE
From some comments down below, I've been alerted to the fact that something must have gone wrong on the command composer create-project, that my solution of just re-requiring all packages shouldn't be necessary. Upon further inspection, I did get some errors upon running command php composer.phar create-project slim/slim-skeleton projectName. Below is exactly what got output from the console after running that command:
php composer.phar create-project slim/slim-skeleton tester
Installing slim/slim-skeleton (3.1.2)
- Installing slim/slim-skeleton (3.1.2): Loading from cache
Created project in tester
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
- phpunit/phpunit 5.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 5.7.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 5.7.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
[.......]
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-imagick.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Would either that .ini extensions issue or Problem 1 php unit requires ext-dom issue be the main source of my problem?
I got lucky and stumbled upon an answer that worked in my situation.
I just had to run php composer.phar require [package_name], for each package name, and if it wasn't in composer.json yet that dependency would get installed. So what I needed to do was delete the composer.json file, then go back and require each package from it. Nothing else worked, such as php composer.phar update, or php composer.phar install.
So I ran php composer.phar require slim/php, php composer.phar require php, etc. from the command line and everything installed correctly.
This is potentially a failure of the getting started documentation from SlimFramework.com, It's not necessarily "wrong" because maybe it works in some/most situations, but they should at least address the potential for the problem I ran into, and a solution or way to avoid it.
EVEN BETTER SOLUTION
Turns out that the main error I was getting here is that I was missing ext-dom. Thank you to this badass #Anar Bayramov's answer on another StackOverflow question I know that I can get the missing ext-dom by simply downloading php7.0-xml.
sudo apt-get update
sudo apt-get install php7.0-xml
And BOOM! Now when I run php composer.phar create-project slim/slim-skeleton projectName all vendor packages are installed successfully and it works like a charm. Problem solved.

Could not find package /laravel/laravel with stability stable

Could not find package /laravel/laravel with stability stable.
So I've got that error when I tried to create new laravel project with the following command:
composer create-project --prefer-dist /laravel/laravel project
And if I try just laravel new project, I get:
laravel: command not found
However laravel is installed, and if I move to its installation folder (which is ~/.config/composer/vendor/laravel/installer), and I type:
php laravel new project
Then it works but I get bunch of * suggests installing *. For example:
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to use psr7 bridging features (0.2.*).)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
And many more.
I'm on Linux Mint Cinnamon 64-bit, and LAMP.
Everything you need is covered in Laravel's extensive documentation.
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer
create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel blog
Note that there is no preceding slash in laravel/laravel.
For the installer to work, again you can refer to the documentation:
Via Laravel Installer
First, download the Laravel installer using Composer:
composer global require "laravel/installer" Make sure to place the
$HOME/.composer/vendor/bin directory (or the equivalent directory for
your OS) in your $PATH so the laravel executable can be located by
your system.
Once installed, the laravel new command will create a fresh Laravel
installation in the directory you specify. For instance, laravel new
blog will create a directory named blog containing a fresh Laravel
installation with all of Laravel's dependencies already installed:
laravel new blog
You can read more about changing your $PATH variable here

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.

PEAR2 - Mbox not installing correctly

Im attempting to install the Mail_Mbox-0.6.3 package as i need to use the classes for accessing email attachments from php.
However when i try to install using the newpackage manager it keeps giving me errors.
php pyrus.phar install pear/Mail_Mbox-0.6.3
Returns the following
Using PEAR installation found at pear2
Downloading pear.php.net/Mail_Mbox
Connected...
PEAR2\Pyrus\Package\Exception: Invalid abstract package pear.php.net/Mail_Mbox
PEAR2\Pyrus\HTTPException: Download of http://pear.php.net/get/Mail_Mbox-0.6.3.phar failed, file does not exist
PEAR2\Pyrus\Package\Exception: Could not download from "http://pear.php.net/get/Mail_Mbox-0.6.3.tgz"
PEAR2\Pyrus\Package\Exception: Unable to save package Mail_Mbox-0.6.3.tgz to downloads directory, pear2/downloads. Do we have permission to write there?
Any ideas?
Works for me:
$ php pyrus.phar install pear/mail_mbox-alpha
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at /home/christian.weiske/php/phpfarm/inst/php-5.3.3/pear
Downloading pear.php.net/Mail_Mbox
Mime-type: application/octet-stream
Installed pear.php.net/Mail_Mbox-0.6.3

Categories