phcli

phcli is a cli tool you can use to handle various aspects of the your web / magentohotel. At the time of writing the following features are available

To use phcli you need to log in to your web or magentohotel using ssh. When logged in type phcli and press enter. Peek%202021-04-29%2010-55 Then navigate the menu by pressing the number next to the wanted action.

Change PHP-CLI version

Changes the php version in cli which is the version you use when you run commands via ssh.

Change PHP-FPM version

Changes the php version in fpm which is the version that the application will be run entering the site from a web browser or any http client.

Add/Remove ServerAliases

Lets you add or remove domains to your webhotel. Adding domains here will point them to the document root the same way as the hotel's main domain.

Add/Remove Pointing Domains

Adding domains here will redirect them to the main domain for the web/magentohotel with status code 301 (permanent)

Edit DocumentRoot

Edit documentroot lets you manage from which folder or subfolder in public_html you want to serve your content. In Magento 2 you would often want to secure your application setting the Document Root to public_html/pub

Edit return path

Lets you change php's return path for mails sent via your web/magentohotel. Normally you set the return path directly in your application or code, however sometimes you would want to set it directly in php.

Restore backup

Previously we had a seperate CLI app for restoring backups. We now implemented this directly in phcli to bring you a simpler, and more effecient way of restoring a backup. You will need the following information to restore your backup.

  • FTP credentials for the backup server. Restoring database backups you will also need:
  • database credentials for the backup you want to restore to.

Flush varnish

This option will be available when using varnish in front of a Magento 2. If you use varnish and Magento 2 and this option is not available please contact Powerhosting support at support@powerhosting.dk

Fix permissions

Sometimes you would want to reset all your files in public_html to the correct owner and permissions. This command will do that for you.

Multistore map

In Magento 2 you can either set your store mappings in index.php or even better in .htaccess. The downside of this, however is that it will be overwritten in upgrades. Therefore we have implemented an upgrade-proof way of setting multistore mappings. The map will be merged with existing web server configuration.

www-prefix

Chose whether you want your domain to be prefixed with www (and without will be redirected to www) or not.

Composer version

You can set the default major composer version, either 1 or 2.

Using arguments

phcli version 0.8.0 added support for arguments. For now it only adds support for the following actions:

  1. set php (fpm/cli) version
  2. set server aliases
  3. get php (fpm/cli) version
  4. get server aliases

Screenshot%20from%202022-07-28%2008-31-46

You can use multiple arguments per command run. Run phcli --help to see syntax.

Set server aliases

Using --set-server-aliases will result in an override of the existing server aliases. To add new server aliases without removing the existing ones please use in combination with --get-server-aliases.

To remove all server aliases run: phcli --set-server-aliases ""