Magento 2.2 with PHP 5.4 - php

I got this job, and they use Magento 2, and I noticed that it can only run with php 7 and up. What is weird is that it runs on the company's server, but when I try to run (in Magento's bin directory) this command:
php magento --version
I get the message that it cannot run on PHP 5.4, and everything tells me the server is running PHP 5.4. I downloaded the Magento 2 website, and there is no alteration. It won't run in my localhost unless I switch to PHP 7.
But how is it running online? The directory is /var/www/vhosts, and /var/www/html is empty. What did the previous programmer do to make it run?

The answer is simple: the previous programmer installed the Magento website using Plesk. The latter allows you to choose which version of PHP you want to run.
In order to run something like (magento-root)/bin/php magento --version, for example, I had to replace php with the Plesk version, which was here:
/opt/plesk/php/7.0/bin/php
The default version of PHP on this server is 5.4, but Plesk is using its own version.

Related

Multiple PHP / Apache Versions on MacOs

At the moment I'm using two machines for Web (Win10) & iOS development (MacOS) and looking to combine them into a one computer that I would use on a daily basis.
My current challenge is to ensure that I can develop and run two or more environments on the same machine (not necessary at the same time, a simple switch would do the job).
I've tried MAMP and AMPPS and they both do the job, with an exception to the PHP-CLI version.
Every time I run php from the console it opens up the latest version completely ignoring the one that is specified by the MAMP or AMPPS.
What is the best way to ensure that php-cli always points to a currently active version of the PHP as stipulated by MAMP or AMPPS?
On Windows I was using https://ospanel.io/ that had it's own internal terminal window that would automatically load the current version of php-cli.
I am fully aware of docker/vagrant but they would be an overkill in this case.
Thanks
Unfortunately there is no simple answer to my question. As a solution:
Get multiple version installed
Design a script that changes the PATH environment to the right version as required.
alternatively a script that rewrites a symlink to a required version of the PHP.
For MAMP user, you must edit the file /usr/local/etc/httpd/httpd.conf and set the PHP version you prefer to use in your stack. I only installed one version of Apache HTTPD with multiple PHP versions - you have to specify the version.
If you don't, the default is the Mac's pre-installed PHP version.

PHP version: module version is higher than installed PHP version

I am using eclipse oxygen for php developers, trying to run php project with version 5.6.
Installed php version: 5.6
PHP version in project facets: 5.6
I tried to follow the the below tutorial, however I could not find php -> interpreter in neither project level nor workspace level.
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.wst.server.ui.doc.user%2Ftopics%2Ftwinstprf.html
How to resolve module(project?) version complaint?
I run in the same problem when I tried to run/debug a PHP project via Run As -> Run On Server.
Since you have not developed in detail your case I will try to present my case such that you might understand what might cause the problem and how to fix it.
So what I did was to choose the Run -> Run As -> Run on Server menu when a wizard-like dialog box was shown. I choose the PHP's Built-in Server, specified a PHP installed executable (like 5.6) then in the next screen ("Modify the resources that are configured on the server") by trying to move my project from the "Available" list to the "Configured" list I've got a notice error like the one you mentioned in the title. In my case the project was configured with PHP 7.1 while the PHP executable chosen in the "Run on Server" dialog box was 5.6, thus the conflict.
So the problem is that your project is defined to be validated by one PHP version while you are trying to run/debug it with another PHP version. What you can do to fix this is one of the following:
either choose a PHP executable for your "Run on Server" session that is compatible with the project's PHP version; this can be done easy right in the "Run on Server" screen .
either configure your PHP project to be validate by the same PHP version as the one you are trying to run/debug your project with; this can be done by right-click the project -> Properties -> PHP -> Validation then choosing the right PHP version
I hope it helps.

PHP Version in Wamp and Command Line Windows not compatible

So basically i am trying to run yii-framework on wamp server but required higher version of php (5.4 above). In my Wamp server, the php version is 5.5 which i have checked on browser (localhost). But the when i run it on windows, it fails because the windows version is only 5.3. It causes the yii framework fail too because when i type php requirements.php. it does not work.
There is no Windows version of PHP so basically you must have installed a version of PHP manually i.e. not with WAMPServer.
This will probably have added an entry on you PATH ( always a bad idea when using WAMPServer anyway as you can have many versions of PHP on your system at one time with WAMPServer)
Look at your PATH and if you must, amend it to point to the PHP in \wamp\bin\php\php{version}
A better way is to remove any reference to PHP from the PATH environmant variable and write a simple batch file to add php to your path only when you want to, like this
Batch file saved in C:\windows\phppath.cmd
echo off
PATH=%PATH%;c:\wamp\bin\php\php5.4.16
Assuming you have php5.4.16 on your wampserver install.

Update Symfoy 2 to newer version

I'm using Symfony 2.0.9 to build a new web site. Yesterday the newer version 2.0.10 went out and I need to update my local project (windows 7) to that version. I saw that using linux the process of update is easy because you just need to run a command and everything works out of the box but in windows there is no written solution. How should I update? Simply overwriting files?
As far as I know the same procedure that is valid for linux is valid for windows as well. The bin/vendors script (the one that updates vendor folders) is actually a PHP script, so you can run it under windows in the same way you run the app/console script.

How to upgrade php on server running Plesk Virtuozzo?

How on earth does plesk actually work? I have a VPS which is on centos 5.2 and has php 5.1.6. I have updated plesk to version 9.52 and it claimed to do some form of php update but it hasn't as far as i can see. How can i update to php 5.2 (centos 5.4) without breaking plesk Virtuozzo?!
Plesk seems to be some kind of crazy black magic that i just don't understand.
Plesk uses whatever version of PHP is currently installed on the server.
You can update PHP to version 5.2 or higher from the IUS repository, but because Plesk looks in the RPM database specifically for the package "php" and not "php52" it will show that PHP is not installed, and PHP will break. I've gotten around this by compiling a dummy php package, with nothing in it, just called "php" so that Plesk won't disable PHP functionality, but that's not the best way to go.

Categories