I am trying to make a bash script on my server to clear the Grav cache. When I run it from the server, it works fine. But when I run it from my local machine, over SSH, I get an error: You are running PHP 5.6.36, but Grav needs at least PHP 7.1.3 to run. However, php -v on my server returns PHP 7.2.11 (cli) and on my local machine returns PHP 7.1.23 (cli). I do not begin to understand what the problem might be.
In the end, I could not resolve the issue of the different PHP versions, but solved the problem by including the path to the correct PHP version in the server script. So, locally I have ssh jeremygrav#ps589716.dreamhostps.com "bash ./clear.sh" and on the server, the script contains /usr/local/php73/bin/php bin/grav cache --all.
That works fine, although I realise it avoids the problem rather than solving it.
Related
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.
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.
I have a local development server and a remote server.
The remote server runs php 5.4, my local server runs XAMPP with php 5.6.
I originally wrote the the php for 5.6, but there are some scripts that produce an error in 5.4.
The obvious solution would be to install XAMPP with php 5.4 locally, but I have multiple site development projects on my computer, some of which which are written in 5.6 and are deployed on 5.6.
Is there a way to make 5.6 at least act like 5.4 so I can test the site locally and find all the errors before deployment?
I thought putting 'AddHandler application/x-httpd-php54 .php' in my root .htaccess might work but it didn't.
There is no way to make 5.6 act like 5.4.
You must have to done changes in your code.
It's impossible.
Think about using virtualization for easy multiple environments.
Vagrant is tool for that, after installation only one command like vagrant up gives you ready to use LAMP server, you can deploy multiple VM with different PHP versions etc.
I tried to install php 5.4 yesterday but it doenst quite work. If i do php -v in Terminal i get 5.3, but if I do php -v in X11 it says that I have 5.4 and i can even start local server and it works just fine. Why doesnt it work in Terminal?
Someone said something about change things in my PATH, maybe thats correct, but how do I do that?
It seems that you have 2 versions of PHP installed but that the 5.4 is not the "default" PHP that is reachable from your PATH (an environment variable telling your system where to look for finding the program you're calling in your command line).
To find where the PHP 5.3 executable is, you could use the which ( http://ss64.com/osx/which.html ) command, on my computer it looks like this :
➤ which php
/usr/local/bin/php
On my system /usr/local/bin/php is just a link pointing to the PHP executable I want to use (I keep several versions of PHP installed on my system in /usr/local/php/<version>/)
You could check what the which command return and if the given result is a symbolic link like mine. If yes, changing the link to make it point to you 5.4 executable should do the trick.
I installed a plugin for NB 7.0.1 which enabled CodeIgniter but when I went to create a project using it, I was told I need to specify a PHP interpreter for Netbeans. I tried to do this using the php.exe you get with Xampp but I get a Java null pointer error. I can't seem to fix this but I'm thinking, why do I need an interpreter on Windows when the Linux machine can do that? I have already set this up on the VM.
Any advice from here? Thanks a lot!
I am using NB 7.1.1 and had similar issue with CodeIgniter plugin when creating a new project. NetBeans would complain No PHP Interpreter was defined in Tools->Options->PHP General. It would not enable finish button so a New Project could not be setup.
I just created a dummy batch file called nb_cli.bat and pointed NB to that for the PHP interpreter. I don't plan on executing (or debugging) CodeIgniter CLI code on local machine so that file will likely never get executed.
If you want to debug or run php locally, make sure xammp works OK outside of NetBeans. But if not, this fix should get you by the NetBeans issues.
I have a separate linux server on my local network for development as I don't need apache/php locally when I use multiple machines for dev/testing/etc.
NetBeans should bugfix that by downing that PHP Interpreter message from an Alert preventing project setup to a warning that No PHP interpreter is defined (or found) so CLI testing may not function.
As an alternative, if you have a linux box with NB installed, you can create the New project there and copy the whole folder (including the nbproject folder) to your PC and you should be able to get by having No PHP Interpreter defined.
Hopefully that gets you going with NB and CodeIgniter. If you need additional details, just ask.