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

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.

Related

PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods in laravel

I want to install laravel on my windows but getting below error
Using below command install laravel
composer create-project --prefer-dist laravel/laravel:^7.0 learning-app
But getting below error in command prompt after run the composer command
PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in C:\xampp\htdocs\vendor\kylekatarnls\update-helper\src\UpdateHelper\ComposerPlugin.php on line 11
Trying all the commands like composer update but not getting any success.
My php version PHP 7.3.27
Anyone have idea how to solve then let me know
You're trying to install the laravel framework locked at a version released more than 2 years ago, is there a reason for this?
Also, what is the version of your composer (run composer --version)? If you're at the version 2 try downgrading to v1 and try again with the same command, if you really want the 7.0 version of Laravel (or simply install the newest version of the framework).

laravel old version is not supporting php 8.0.8

I have installed php 8.0.8 on my local computer. Laravel new projects work perfect. But when I try to run Old projects it shows me error. When I try to run command
composer install
It gives me the error below:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
When I run:
composer dump-autoload
It shows this error:
Generating optimized autoload files Class App\Http\Controllers\Vendor\OrderController
located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Controllers\temp\OrderController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Http\Resources\profile\AddressesResponse located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Resources\Profile\AddressesResponse.php does not comply with psr-4 autoloading standard. Skipping.
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> #php artisan package:discover --ansi
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Unfortunately, older versions of Laravel doesn't not support newer versions of PHP. Laravel 6 is the minimal version for PHP 8.0 support (and it is already pretty old from a web development perspective).
Of course, this is for a fresh installation, you might have code in your project that is also not PHP 8.0 compatible.
About this error:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
The problem will be easy to fix, just install the soap extension. You seem on Windows so it should already installed but disabled.
You will have to uncomment ;extension=soap.dll in your php.ini file (or maybe in the ext directory located in your php directory, it depends).
There will probably be other extensions required but disabled, to get a full list execute composer check.
This is what is preventing composer from installing your dependencies (which lead Uncaught Error: Class "Illuminate\Foundation\Application" not found in to when you are calling composer dump-autoload).
I searched out and found a solution regarding this issue. Only single command is the solution
Note: Don't update composer.
composer install --ignore-platform-reqs

How to convert laravel 7.1.3 projects to run on laravel 8.0.0? [duplicate]

after updating my mac to php 8 laravel app stopped working, this is the error I'm getting:
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945
I've tried to fix the issue by investigating the code with no luck
THE SOLUTION
As explained here latest version of laravel 6, 7 and 8 has made changes required for php 8. all you have to do is:
1- add php 8 to your composer.json (I've kept v7.4 just in case production server does not support php 8 yet)
"php": "^7.4|^8.0",
2- to run composer update to update your laravel to the latest version
composer update
3- make sure update the following libraries since they exist in all laravel applications
PHP to php:^8.0
Faker to fakerphp/faker:^1.9.1
PHPUnit to phpunit/phpunit:^9.3
4- check for any other library which needs to be updated, contribute if they haven't supported php 8. but you should be good to go with most of the libraries since they have active contributors.
EXPLAINING THE PROBLEM
as described here
PHP 8 introduces several improvements in PHP type systems such as the introduction of Union Types, mixed type, and a few more.
With these changes, certain methods in Reflection API's
ReflectionParameter yield incorrect results.
In PHP 8, the following methods from ReflectionParameter class is
deprecated:
ReflectionParameter::getClass()
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParamter::getType() is the recommended way to replace the
deprecated methods. This method is available in PHP 7.0 and later.
Check your php version in your virtual machine(xampp or server).
php --version
Is that version PHP 8 ? Am I right? That's the cause of the problem:
PHP 8 introduces several improvements in PHP type systems such as the introduction of Union Types, mixed type, and a few more.
With these changes, certain methods in Reflection API's ReflectionParameter yield incorrect results.
In PHP 8, the following methods from ReflectionParameter class is deprecated:
ReflectionParameter::getClass()
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParamter::getType()
Downgrade your php version to 7.4 and your Laravel app works like a charm!
I had similar issue. But I had already run brew update and brew cleanup before I noticed the issue. What I did:
I noticed this error from brew cleanup:
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite heroku-node
I ran the commands:
brew link --overwrite composer
composer upgrade
composer update
That's what worked for me
If you're using valet you should do the followings:
Downgrade from php8+ to php7.4 valet isolate php#7.4
Then run composer update using valet valet composer update

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

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

what is the solution for php_mysql.dll ext in laravel with php 7 and IIs7

I am using laravel latest framework (5.3.*) with IIS7 and php7. It is showing a warning for create project or any artisan command like
c:\inetpub\wwwroot\test>php atisan serve PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ v7.0\ext\php_mysql.dll' - %1 is not a valid Win32 application. in Unknown on line 0
I want to create my project with latest version of php and laravel but with php7 the php_mysql.dll is deprecated. How can I prevent the warning of php_mysql.dll?
Did you copy php.ini from a previous installation of PHP 5.x? It looks like you have copied the extensions and php.ini from a previous installation of PHP 5, compiled with a different version of VC or 32/64bit.
To solve the issue, you should just need to open your php.ini, and comment out or remove the line:
extension=php_mysql.dll

Resources