Using Composer to install mailparser, why am I getting an error that allow_url_fopen must be enabled when it already is enabled? - composer-php

I am trying to install this PHP mailparser. I have Composer installed and the required mailparse extension is also installed. However, when I run:
composer require php-mime-mail-parser/php-mime-mail-parser
I get the following error:
[Composer\Downloader\TransportException] The
"https://repo.packagist.org/packages.json" file could not be
downloaded : allow_url_fopen must be enabled in php.ini (https://
wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)
However, I've checked php.ini and it clearly says it's enabled, i.e.
allow_url_fopen = On
How could I get that specific of an error about needing to enable allow_url_fopen even though it definitely IS enabled?

Run this command:
php -d allow_url_fopen=on <composer_path> <composer_arguments>
Replace <composer_path> with the direct path to the composer executable (e.g. /opt/cpanel/composer/bin/composer) and <composer_arguments> with the arguments you are passing to composer (e.g. require php-mime-mail-parser/php-mime-mail-parser).

This works for me:
php -d allow_url_fopen=1 /opt/cpanel/composer/bin/composer install

Related

composer require yajra/laravel-oci8:^8 in laravel 8

PHP version 7.3.22
Running on Laravel Framework version 8
root#df77c47e6f1e:/var/www/oracle-laravel-v8# composer require yajra/laravel-oci8:^8
PHP Warning: PHP Startup: Unable to load dynamic library 'oci8_12c' (tried: /usr/lib/php/20180731/oci8_12c (/usr/lib/php/20180731/oci8_12c: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/oci8_12c.so (/usr/lib/php/20180731/oci8_12c.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_oci' (tried: /usr/lib/php/20180731/pdo_oci (/usr/lib/php/20180731/pdo_oci: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/pdo_oci.so (/usr/lib/php/20180731/pdo_oci.so: cannot open shared object file:
No such file or directory)) in Unknown on line 0
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is about to be released and the older 1.x releases will self-update directly to it once it is released. To avoid surprises update now to the latest 1.x version which will prompt you before self-updating to 2.x.
Run composer self update command and clear composer cache
composer self-update
Then
composer clear-cache
There is nothing wrong about laravel and composer here. It seems that your system's php installation/configuration is wrong (pdo_oci extension is missed or misconfigured) so it can't process anything, even fails at composer startup.
Composer itself is package manager written in php. And laravel is framework written in php. So it's laravel is running on php, not vice versa.

I want to create image intervention

For user profile I want to create profile picture, but when I write composer require intervention/image in terminal I get this error:
- intervention/image 2.4.1 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- intervention/image 2.4.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- Installation request for intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1].
To enable extensions, verify that they are enabled in your .ini files:
- C:\AppServ\php5\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
Read what Composer suggests. Just install the PHP extenion fileinfo. Check the installation guide on PHP.net: http://php.net/manual/en/fileinfo.installation.php
Make sure you have the php_fileinfo.dll in your php/ext folder. Then uncomment this line in your php.ini
extension=php_fileinfo.dll

how to install package with composer?

I am trying to install a push-notification library for codeigniter using composer fromhere .But when i do run a command it throws this error -> Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for wrep/notificato ^1.2 -> satisfiable by wrep/notificato[1.2.0].
- wrep/notificato 1.2.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- E:\xampp\php\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I also did commented the php.ini extension=php_intl.dll and also its the same error occuring. How can i solve this?

How to configure the Laravel built-in web server?

I am running this command:
C:\xampp\htdocs\notebook>php artisan serve
However I get this error:
Warning: require(C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\notebook\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\notebook\bootstrap\autoload.php on line 17
After creating a project or cloning existing one you should run composer install command which will install all dependecies and will create autoload.php file.
That is an import error.
Everytime you have one of these, you should try to run composer dump-autoload.
Most of the time, this command will fix your imports.
It looks like you might not have installed the required dependencies yet. You should do so using the composer package manager, like so:
C:\ProgramData\ComposerSetup\bin\composer install

Composer error installing laravel-cors

I tried to install laravel-cors
composer require barryvdh/laravel-cors
It installed successfully or so I thought, but then when I went to publish the config I get this error:
[RuntimeException]
Error Output: PHP Fatal error: Cannot redeclare Composer\Autoload\includeFile() (previously declared in /www/vendor/composer/ClassLoader.php:410) in /www/config/vendor/composer/ClassLoader.php on line 413
I have tried removing laravel-cors and I still get this error. I have dumped autoload as well. What am I missing?
Larval 5.2 | PHP 5.6.17
I figured it out. When i typed
composer require barryvdh/laravel-cors
i was in a sub directory. so composer then installed it and the dependencies in a sub directory which is why i was getting that error. If you look closely you can see that it was installing in config
/www/config/vendor/composer/ClassLoader.php:413
/www/vendor/composer/ClassLoader.php:410
Just needed to pay better attention to detail.

Resources