Currently, I have a problem with my Symfony project because I made the php update. And now, I can not use my compose in the folder of my project anymore. How can I remedy this problem ?
I installed PHP version 7.3.4.
I have version 1.8.5 of composer.
Error Image:
You can disable JIT like #Sondre Edvardsen said but that will it disable for all projects.
You can also disable it for the single command with:
php -d pcre.jit=0 composer.phar {...rest of your command}
Related
I've installed the admin package Voyager (without dummy data) on my Laravel project and when I want to create a user to access the admin panel with the following command: php artisan voyager:admin admin#admin.com --create, I get the following error:
After a little bit of searching, I found this link: https://github.com/the-control-group/voyager/issues/5082 => saying that this command does not work with PHP 7.4 and to make it work, I should either upgrade to PHP 7.4.1 or downgrade to PHP 7.3.
I'm using Wamp Server and decided to downgrade to PHP 7.3.12 since this version exists by default in C:\wamp64\bin\php
I have also edited composer.lock and composer.json in my project and then ran the command composer dump-autoload. But it still doesn't work. Am I missing something?
Had the same issue, upgraded to php 7.4.27 and it worked.
I want to use latest stable laravel 8.0 version for windows. but I cannot install using cmd. I want to crate new laravel project so I tried with this command which is available in laravel documentation.
cmd command .
composer create-project --prefer-dist laravel/laravel:^8.0 blog
Hope this helps : https://www.sitepoint.com/how-to-install-php-on-windows/ .
Download the PHP 8 using command and do the needful configuration.
What you are trying to do is run a composer script in a PC which does not have PHP installed.
First, download PHP from here;
PHP Windows download
Then, install composer from here;
Composer installation instructions
Both links have instructions on how to proceed with the installations. After you do both these, you can run that composer command in the command line.
I hope you know that composer is a dependency manager and PHP is the interpreter of the language. Happy coding.
So i just updated composer using the command composer self-update --2,
However, now my web application shows the error Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0".
I dont understand this because doing php -v gives me PHP 7.4.13
How can I fix this?
Your terminal user's PHP version may differ from the server's version.
You may have 7.4.13 on terminal while having a completely different PHP version in apache2 or whatever server you are using.
Use phpinfo(); in a PHP file and access it via browser to see the actual PHP version.
Here is quick solution that work for me
In you project you can check the platform check file
projec-path/vendor/composer/platform_check.php
$issues = array();
after this Remove or comment the extra code
Add the platform check option in the composer.json config section like this.
"config": {
"platform-check": false
},
After that, you need to run
composer update
After the composer update platform_check.php will be deleted and project work fine.
Please run this command:
composer install --ignore-platform-reqs
If you add the --ignore-platform-reqs option when running Composer update, it will ignore restrictions. Click here for more information.
I simply change the file platform_check.php which was showing the PHP_VERSION_ID >= 70400. change it to 70300 (This is for PHP >=7.3) This solve my issue.
I ran into this issue after installing a new version of PHP on a server using IIS. Not realizing that IIS didn't support verbs like UPDATE/PATCH out of the box, and these methods were being utilized by the website. When a route was accessed via PATCH for instance, the new version of PHP was not handling that, so it fell-back to the old version of PHP -- and that's when this error presented itself.
Resolving it was simply a matter of editing the Handler Mappings in IIS. I found the mapping that would point *.php files to my new version of PHP, and customized it so that it would support other verbs like PATCH
Just update your version of PHP in cpanel.
I ran into the same issues and this helped me.
Problem is sometimes we forget to change the php version at server(platform) level, which is usually different from the dependency level or cli after an update or upgrade or even sometimes on a fresh installation.
For anyone using cpanel, ensure to update your php on the cpanel to the one used on the application or during development.
For anyone using apache, check your apache conf file for the project to make sure it has the same php version running in your cli i.e used by composer.
For anyone using nginx, check your nginx conf file for the project to make sure it has the same php version running in your cli i.e used by composer.
For anyone using valet check your current project' valet php version, to make sure its the same as the one used by composer, to change php version: valet use php[x.x]
Summary.
Check your server configuration to make sure it has the same php version required by your application.
inform required "require" version if desired or remove from composer.json
always put the ^ to indicate that the version can be equal or greater
then run composer update
in my case, it worked
{
"require": {
"php": "^7.4"
},
"autoload": {
"psr-4": {
"App\\": "App"
}
}
}
I have faced the same issue on my server. And it is mainly happened due to miss-match of php version between server version and your system version. I am using Nginx and checked on all my project configuration files, it uses php8.0 but on my terminal it shows php.8.1. Actually my application needs php8.0. The following steps resolved my issue.
To see all my running php versions
sudo update-alternatives --config php
It shows the following page
Selecting php8.0 for my application. Run the command to see Nginx scripts are ok
sudo nginx -t
Then reload the Nginx
sudo systemctl reload nginx
Finally go to your project directory and update or install your composer
composer update
It has been resolved my issue, I expect same will resolve yours.
Problem Statement: "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0"
It'll solve your problem 100% .
Use this fragment " --ignore-platform-reqs " while adding other pacakge without disturbing other package dependency .
for example
composer require giggsey/libphonenumber-for-php --ignore-platform-reqs
Ive been just starting to learn Symfony PHP framework, and Ive run into some problems with its configuration.
When trying to create a new project with command line like so:
symfony new --full my_project
I kept getting a simple error message:
no PHP binaries detected
and no files were created in the current folder. I searched on the net, and found out that Symfony apparently isnt able to find the location of my php.exe, despite it already being set in my system variables. And there was no information about how to properly configure this in Symfony.
How do I fix this error?
Turns out Symfony already contains functions to autodetect installed PHP versions from system variables. The command to fix the Symfony configuration is this:
symfony local:php:refresh
My next attempt to create a new project work fine after that.
Also, I suspect this error was the result of me installing PHP files after installing Symfony.
symfony local:php:refresh
doesn't always work. If your php is not in [/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /usr/games /usr/local/games /snap/bin] and a few other locations (check with symfony local:php:list -vvv) then symfony won't find it.
I compiled my own PHP from source and installed versions 7.4.20 and 8.0.7 in /home/username/php/7.4 and /home/username/php/8.0. If I want to use my PHP 8.0.7, then I have to make a symlink because updating the $PATH doesn't help.
sudo ln -s /home/username/php/8.0/bin/php /usr/local/bin/php
This works and symfony finds it.
Follow below steps:
Step 1: download & Install xampp in your system
Step 2: open the xampp folder.
find php folder and hit enter
Step 3: copy the path and paste in your system environment
Step 4 : run
php -v
you are good to go!
I want to change the PHP version because my version is 7.1.23 and I need to upgrade to 7.2 for install a package that I want to use.
I'm using MAMP on Macbook Pro.
Here's what I've done :
I've add this line in this .bash_profile file :
export PATH=/Applications/MAMP/bin/php/php7.2.14/bin:$PATH
In the composer.json file I've update the version to
"require": {
"php": "^7.2.14"
I've create a .php-version in the project directory. It contains :
7.2
If I do "php -v" in my terminal I've that :
~ php -v
PHP 7.2.14 (cli) (built: Feb 1 2019 12:25:00) ( NTS )
When I launch my project with "symfony serve", that give me :
The Web server is using PHP CGI 7.2.14
https://127.0.0.1:8000
But when I want to make "composer update" or "symfony local:php:list" it return me that I'm still using PHP version (7.1.23).
How can I finally upgrade the version ?
Here's a screen from my terminal :
okay, so as far as I can tell, your symfony command already uses 7.2.14 (highlighted version in first column, ignore the * in the last column, it only tells what is the system's default), since it says so on symfony serve.
composer however doesn't, which is most likely due to the fact that composer is a php script that is made executable via a hash bang at the very first line of the file (and the x chmod):
#!/usr/bin/php
which essentially says, "run me with the interpreter/command /usr/bin/php". There are other variants of composer around, some have #!/usr/bin/env php which will look for a php in the PATH variable and use that instead.
However, to fix this, I propose these reasonable options
run composer with an explicit php (check composer path with which composer):
php /usr/bin/composer update
which obviously is a bit inconvenient, or
just install another composer, which is most likely more recent anyway and add it to your PATH before /usr/bin like you did with your alternative php version, which will allow you to run it standalone/independent, or
use the symfony script to run composer:
symfony composer update
disclaimer. I haven't actually tried this, but I would be surprised if this didn't run composer with the correct php version...
I had the same problem and I solved it by creating a file ".php-version" that contains the php version number (ex : 8.1.2) in the project directory