Answers.Body: <p>Where did you define your aliases? If you haven't already, you could start by adding directives for both php and composer in your <code>.bash_profile</code>.</p>
  <p>The file should contain something like (alter paths as appropriate):</p>
  <pre><code># Include the location of the PHP 7.4 binary in your path
  export PATH=/opt/plesk/php/7.4/bin:$PATH
  # Ensure that any calls to composer are run with the PHP 7.4 binary
  alias composer='/opt/plesk/php/7.4/bin/php /usr/lib64/plesk-9.0/composer.phar'
  </code></pre>
  <p>Log out/in (or source .bash_profile) and run <code>php -v</code> to check it's picking up the correct binary, then have another go.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-26T10:19:05.050Z
Answers.Text: Thanks. It turned out the issue was due to a shebang in the Craft files, which ultimately led to `/usr/sbin/php`.  THe php *there* was php5.  I solved it by renaming php and adding a symbolic link `ln -s` from php to php7.4.  Does your solution solve this same problem?
Answers.UserDisplayName: Robert Frost
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-25T14:51:38.783Z
Answers.LastActivityDate: 2020-10-25T14:51:38.783Z
Answers.UserDisplayName: Wallace
Body: <p>This is a problem encountered apparently by a lot of users when installing from the Craft setup/install files from the Craft web site.</p>
  <p><code>PHP Warning: Unsupported declare 'strict_types' in /var/craft/vendor/voku/portable-utf8/src/voku/helper/Bootup.php on li PHP Fatal error: Default value for parameters with a class type hint can only be NULL in /var/craft/vendor/voku/portablec/voku/helper/Bootup.php on line 27 Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255</code></p>
  <p>The following scenario yields this error:</p>
  <ul>
  <li><p>A fresh install of craftcms</p>
  </li>
  <li><p>installed with composer</p>
  </li>
  <li><p>using these instructions: <a href="https://craftcms.com/docs/getting-started-tutorial/install/files.html#what-s-composer" rel="nofollow noreferrer">https://craftcms.com/docs/getting-started-tutorial/install/files.html#what-s-composer</a></p>
  </li>
  <li><p>On a bran new unused DigitalOcean Plesk/Centos7 machine</p>
  </li>
  <li><p>with php aliased to the Plesk php 7.4 folder</p>
  </li>
  <li><p>With CLI php -v verified as returning 7.4</p>
  </li>
  <li><p>With all the required php extensions</p>
  </li>
  <li><p>With the web server visited and phpver command verified as returning 7.4</p>
  </li>
  <li><p>with composer updated</p>
  <p><code># composer depends danielstjules/stringy</code></p>
  <p><code># voku/stringy 6.4.0 replaces danielstjules/stringy (~3.0)</code></p>
  </li>
  </ul>
  <p>Diagnosing it, Right, putting <code>echo phpversion();</code> into Bootup.php and running from Bash returns 7.4.</p>
  <p>But comment everything in Bootup.php out, put <code>echo phpversion();</code> into it and run craft, and when it calls Bootup.php, it returns 5.4.16.</p>
  <p>Why is this?  Why does it run with a different php version when run from within the Craft script, and how is this fixed to run with 7.4?</p>
  
Tags: <php><install><installation><composer>
Title: Why does Bootup.php run with PHP 5.4.16 from with Craft script but PHP 7.4.10 from the terminal command line?
ThreadText: # Why does Bootup.php run with PHP 5.4.16 from with Craft script but PHP 7.4.10 from the terminal command line?
  
  (Asked by: username_0 on 2020-10-03)
  
  This is a problem encountered apparently by a lot of users when installing from the Craft setup/install files from the Craft web site.
  
  `PHP Warning: Unsupported declare 'strict_types' in /var/craft/vendor/voku/portable-utf8/src/voku/helper/Bootup.php on li PHP Fatal error: Default value for parameters with a class type hint can only be NULL in /var/craft/vendor/voku/portablec/voku/helper/Bootup.php on line 27 Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255`
  
  The following scenario yields this error:
  
  * A fresh install of craftcms
  * installed with composer
  * using these instructions: <https://craftcms.com/docs/getting-started-tutorial/install/files.html#what-s-composer>
  * On a bran new unused DigitalOcean Plesk/Centos7 machine
  * with php aliased to the Plesk php 7.4 folder
  * With CLI php -v verified as returning 7.4
  * With all the required php extensions
  * With the web server visited and phpver command verified as returning 7.4
  * with composer updated
  
    `# composer depends danielstjules/stringy`
  
    `# voku/stringy 6.4.0 replaces danielstjules/stringy (~3.0)`
  
  Diagnosing it, Right, putting `echo phpversion();` into Bootup.php and running from Bash returns 7.4.
  
  But comment everything in Bootup.php out, put `echo phpversion();` into it and run craft, and when it calls Bootup.php, it returns 5.4.16.
  
  Why is this? Why does it run with a different php version when run from within the Craft script, and how is this fixed to run with 7.4?
  
  **Tags:** php, install, installation, composer
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-25. Score: 1
  
  Where did you define your aliases? If you haven't already, you could start by adding directives for both php and composer in your `.bash_profile`.
  
  The file should contain something like (alter paths as appropriate):
  
  ```
  # Include the location of the PHP 7.4 binary in your path
  export PATH=/opt/plesk/php/7.4/bin:$PATH
  # Ensure that any calls to composer are run with the PHP 7.4 binary
  alias composer='/opt/plesk/php/7.4/bin/php /usr/lib64/plesk-9.0/composer.phar'
  
  ```
  
  Log out/in (or source .bash\_profile) and run `php -v` to check it's picking up the correct binary, then have another go.
  
  > **Comments:**
  > **username_0**: Thanks. It turned out the issue was due to a shebang in the Craft files, which ultimately led to `/usr/sbin/php`.  THe php *there* was php5.  I solved it by renaming php and adding a symbolic link `ln -s` from php to php7.4.  Does your solution solve this same problem?  
  
  ---
  
  