I am totally a newcomer to Sage 9. I just developed a theme using PHP 7.1 and ran into trouble when deploying it using FTP to a clients’ host service.
Their hosting has only PHP 7.0 as the latest version. What I can do locally to resolve this.
I am totally a newcomer to Sage 9. I just developed a theme using PHP 7.1 and ran into trouble when deploying it using FTP to a clients’ host service.
Their hosting has only PHP 7.0 as the latest version. What I can do locally to resolve this.
I am using Trellis and Bedrock. Is there a way for me to change the settings there to resolve this? THX!
It might not be a bad idea to see if the hosting service can bump their PHP version. You could be doing them a favour since PHP 7.0 is EOL by the end of this year (as well as 5.6). I’ve been successful with bumping a few client sites to 7.1 or 7.2 recently.
If that doesn’t work, you could just revert the Composer dependencies that require 7.1 back to what they were before c5a1782
(or somewhere around there).
Thank you so much. I asked them and they would not help… I also tried to use composer in Sage to revert to 7.0. But it seems to break the Version check function in functions.php. Any idea to how fix that?
The version check in functions.php
can be changed by modifying the string it checks, which is clear from looking at it.
As for downgrading to 7.0, you can run composer depends php
to get a list of all the packages in your theme that depend on PHP. You can use that to determine which packages require a version of PHP that is too high. From there, you can downgrade them as necessary.
I will try it tomorrow and report back here. Thank you!
got this error message:
( ! ) Parse error: syntax error, unexpected ‘if’ (T_IF) in /srv/www/aquasoleilhotel.com/current/web/app/themes/aquasoleil/resources/functions.php on line 28
It happened after I replaced with the one I saved my github repository. At my wits end.
I can’t help you debug that without your code. I have no idea what’s on line 28 in your functions.php
, or around that line.
That said, syntax error, unexpected 'if'
usually means you forgot a semicolon, or forgot a closing bracket or parenthesis, or something like that, on the preceeding line. Check line 27 and make sure everything about it is kosher.
Thank you so much… I will double check. Just made it working again on my local dev. Ready to downgrade locally then upload to the server…
Will report back after that.
Here is my output:
brain/hierarchy 2.3.1 requires php (>=5.5)
doctrine/inflector v1.3.0 requires php (^7.1)
hassankhan/config 0.10.0 requires php (>=5.3.0)
illuminate/config v5.6.17 requires php (^7.1.3)
illuminate/console v5.6.17 requires php (^7.1.3)
illuminate/container v5.6.17 requires php (^7.1.3)
illuminate/contracts v5.6.17 requires php (^7.1.3)
illuminate/events v5.6.17 requires php (^7.1.3)
illuminate/filesystem v5.6.17 requires php (^7.1.3)
illuminate/support v5.6.17 requires php (^7.1.3)
illuminate/view v5.6.17 requires php (^7.1.3)
nesbot/carbon 1.27.0 requires php (>=5.3.9)
psr/container 1.0.0 requires php (>=5.3.0)
psr/log 1.0.2 requires php (>=5.3.0)
psr/simple-cache 1.0.1 requires php (>=5.3.0)
roots/sage dev-master requires php (>=7.1)
roots/sage-lib 9.0.1 requires php (>=7)
soberwp/controller 9.0.0-beta.4 requires php (>=5.6.0)
squizlabs/php_codesniffer 2.9.1 requires php (>=5.1.2)
symfony/console v4.0.8 requires php (^7.1.3)
symfony/debug v4.0.8 requires php (^7.1.3)
symfony/finder v4.0.8 requires php (^7.1.3)
symfony/polyfill-mbstring v1.7.0 requires php (>=5.3.3)
symfony/process v3.4.8 requires php (^5.5.9|>=7.0.8)
symfony/translation v4.0.8 requires php (^7.1.3)
symfony/yaml v3.4.8 requires php (^5.5.9|>=7.0.8)
Where I go form here? Have never done this before. Should I check out each package? That is a lot of info to figure out.
You would need to evaluate which packages on that list require PHP > 7.0, then either downgrade them directly in your composer.json
(if they’re required there) or downgrade the packages that require them to versions that require a version of PHP that works for you. You can run composer depends php --tree
to see a tree-style display of your required packages. You can also run composer depends
on any package, i.e. composer depends illuminate/config
to see what package(s) requires it. With the above tools and some elbow grease you should be able to figure it out.
Once you’ve downgraded all those packages you would need to make sure everything works without them. You’d also want to make sure that you are using features introduced in 7.1 or 7.2 in your actual code.
I will report what I did in a reply below. Not sure what I am doing is the right way or not. But thank you for much your great helps. Sure solved my problem.
I follow knowler
’s instruction and downgrade to an older version of Sage by copying over composer.js
and also I deleted composer-lock.js
:
If that doesn’t work, you could just revert the Composer dependencies that require 7.1 back to what they were before
c5a1782
(or somewhere around there).
Run composer install
again.
In functions.php
: change the version number from 7.1 to 7.
/**
- Ensure compatible version of PHP is used
*/
if (version_compare('7', phpversion(), '>=')) {
$sage_error(__('You must be using PHP 7 or greater.', 'aquasoleil'), __('Invalid PHP version', 'aquasoleil'));
}
I had a problem with extend-cpts
when ftp-ed the production files in the live site. So I included its package files outside vendor
folder.
Run yarn build:production
For now, I chose to upload everything in the theme folder except node_modules
. I am still working on a test site and this is my first time using Sage, so I will use it as a backup. Will modify the process when I am more familiar and knowledgable with this.
assets
folder that are used in SASS for backgrounds. For example: url(../images/filename.jpg)
in a .scss file. The production output path evidently is wrong. url(sitename/app/resources/assets/images/filename-hash.jpg)
. I had to manually change them in the main.css
file on the live site. Any clue on this?Thank you guys for your help! What a great community we have here.
Switch hosts.
Honestly, if possible, this will be less painful.