Installing Laravel 5.1 application to server with older PHP version - php

I created a webapplication using Laravel 5.1 and PHP v. 5.6. However, I need to clone this into a CentOS server which has PHP v. 5.4.16 installed.
Whenever I run composer install, I get the following error:
Warning: The lock file is not up to date with the latest changes in
composer.json. You may be getting outdated dependencies. Run update to
update them. Your requirements could not be resolved to an installable
set of packages.
Followed by packages that require PHP >= 5.5.9.
Is there a workaround to make this application work without updating PHP?
Thanks in advance!

You cannot install Laravel 5.1 on a server running PHP 5.4. You really have 2 options:
Try upgrading PHP
Migrate your application to Laravel 5.0
Migrating should not be that much work, especially if you have tests setup for your application. There will be some features in your 5.1 app that you may lose and have to work around to migrate to 5.0, but overall, it shouldn't be too difficult.

Related

Does Laravel 8 require PHP 8.1?

So.. I developed a project with Laravel 9, then I had to upload it to my client's server by FTP ( which was slow and painful ) to find out only afterwards that my client's server PHP version could not go over 8.0. I tried to open the project live link ( to where I uploaded ) and the composer platform check was telling me my project had dependencies on PHP 8.1 and that my version is 8.0.
So I tried tweaking the platform check php file to disable this check, to see if it would work anyways but no, the project was throwing errors.
So I decided to downgrade to laravel 8, because after searching around I read that laravel 8 did not need php 8.1.
I guess I read some wrong information because after tweaking my project to downgrade to laravel 8 and uploading again (painfully by ftp), the platform check was again telling me that my project needed PHP 8.1.
So I disabled again this platform check by editing/tweaking the platform check php file, to see if it would work anyway, and it did work. So all good. but then today I was learning how to check which composer packages had dependencies on a specific php version, and in the process I found out (if I'm not wrong) that laravel 8 has package dependencies that depend on PHP 8.1 ?
Is there a table somewhere I can check which Laravel versions depend on which PHP versions or do I have to run some commands on each project to check these dependencies?
Like in the images below:
Thanks !
Laravel 9 does not require PHP 8.1 it requires PHP 8.0.2
If this a shared project and someone else with PHP 8.1 generated the composer.lock file (or indeed you locally have PHP 8.1 but the server has 8.0) you might end up with packages that require PHP 8.1. Composer resolves and installs packages based on the locally installed PHP version.
You can override this behaviour and ensure everyone gets package deps based on the PHP version you expect to have on production if you use the platform config option in your composer.json e.g. add this to your composer.json
"config": {
"platform": {
"php": "8.0.2"
}
}
Then run
composer update
this should try to fix your package versions to ones that work with PHP 8
Short response no, Laravel 8 requires PHP >= 7.3
From Server Requirements
But, since you downgraded it is possible that some php packages require newer php versions no matter the version chosen for Laravel.
Some hints:
Change dependencies (packages) version, probably downgrade them.
Delete the vendor folder.
Delete composer.lock
Run composer install
Checking your screenshot: with symfony the downgrade will not break anything.
But, check the other package/s ie: tojsverkoyen/css-to-inline-styles requirements.

How to install laravel 5.8 with xamp

i am newbie with laravel and tryng to download 5.8 version in a server xamp.
But, when i try the command in the terminal of Xamp:
composer create-project --prefer-dist laravel/laravel blog "5.8.*"
returns
[InvalidArgumentException]
Could not find package laravel/laravel with version 5.8.* in a version installable using your PHP verson 8.0.5
Someone have a idea of what i can do?
Laravel 5.8 doesn't support php 8, you should probably consider using laravel 8
Xampp versions follows PHP's, so you should download something like 7.1.3x. This can be done on the download page, assuming you are using windows this is the link.
In general for choosing PHP versions, it is most optimal to go with the version that is used on the production server.
If you really want to use Laravel 5.4, then you'd need to go with PHP 7.* and I'd recommend going with Wamp (https://www.wampserver.com/en/) instead of Xampp, which allows you to switch between php versions with one click.
However try using laravel 8 if laravel 5.4 is not a requirement

Issue of running laravel previous version on laravel 5.6

I am having some problem running Laravel 4 project on my environment.
My development environment:
MacOS High Sierra
Laravel 5.6
PHP 7.1.14
Homebrew 1.6.4
XAMPP 7.1.16
Composer version 1.6.2
When I try to do
php artisan serve
It shows me error message:
Mcrypt PHP extension required.
I checked that Mcrypt is already deprecated by the community, and I saw a lot of solution for install Mcrypt on php 7.1, but it all doesn't work out for me. I am thinking about just upgrade entire project laravel 4 to laravel 5.6 manually. Do you guys have any recommendation for case, either the manually upgrade or solve the dependency problem?

Error in installing Symfony4

I am new to Symfony skeleton. Can anyone please help to get out from this error for installation of Symfony? I had searched a lot on the internet but cannot find any working solutions. Composer is working well. I am using PHP7 and XAMP server.
Error is Could not find package Symfony/skeleton with stability Stable in a version installable using your PHP version 7.0.2.
Cerad's answer is correct. Please check Requirements for Running Symfony
It states the following:
Symfony 4.0 requires PHP 7.1.3 or higher to run, in addition to other minor requirements.
If you have to live with php7.0, you are able to install the symfony demo project via symfony installer, see how to install symfony installer for sf3.4.
After you have installed sf installer, you can install the demo project with old symfony version by doing:
$ symfony new blog 3.0.1
As mentioned by Cerad, you need have php7.1 or newest php version to install latest symfony demo project. But you can also have a try to install the demo project with older version by doing:
$ composer create-project symfony/website-skeleton:3.3
you can find the the release version which you need here
You just need to change your Php version from 7.02 to upper version.
I had the same issue, my path variable was pointing at php7.0., change it to php7.2. and the problem solved immediatly.
Important : Don't forget to restart you terminal.
I had a similar problem not being able to find 4.4 without php version part.
In case some one comes in contact with this (As I did), installing Symfony CLI and using it instead of direct composer, might solve the problem.
I was actually able to install Symfony 4.4 project as below
composer create-project symfony/website-skeleton:"^6.0" yourProjetName
try to specify the version 6.0
It solved my problem
I encountered this error while installing Symfony Demo App (Symfony 6). If your PHP runtime has passed symfony check:requirements, you may want to enable PDO-SQLite PHP extension or other project requirements such as the supported PHP version - Symfony Demo's Requirements.
Assuming that OP's goal is to setup and install Symphony, according to Synfony's Official Docs there are various ways one can go about doing it.
First of all, make sure one is satisfying all the requirements. For my example I will be using the most recent versions of Symphony and PHP:
Install PHP 8.1 or higher and these PHP extensions (which are
installed and enabled by default in most PHP 8 installations): Ctype,
iconv, PCRE, Session, SimpleXML, and Tokenizer;
Install Composer, which is used to install PHP packages.
Optionally, you can also install Symfony CLI. This creates a binary called symfony that provides all the tools you need to develop and run your Symfony application locally.
In this case, it seems that OP has already installed both PHP and composer, however OP might have to update the PHP version (as Cerad mentioned).
Now, depending on one's goals, there are different ways to move one:
If one is building a traditional web application open the CMD or Git Bash, and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Then
cd my_project_directory
And
composer require webapp
If one is building a microservice, console application or API, then open the CMD or Git Bash and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Notes:
In both cases, by specifying the version shouldn't give us the error that OP is facing.
If error keeps on appearing, would recommend using CMD or Git Bash as I've tried here and worked fine with both.
you forgot to specify the installation folder. Use a dot to install in the current folder.

Laravel 5.3: PHP Version issue on remote host

I am using Site5 which allows multiple php. So I tried to run composer install and it welcomed me with various version related errors. Laravel 5.3 needs 5.6+ and I have 5.5 installed but my hosting allows various version including PHP7. PHP7 is installed as /usr/local/php70/bin/php
Now how can I make composer and artisan to use these commands. Specially composer

Categories