Issue

Starting with version 2019, Zend Server for IBM i includes Composer for internal use, but the command to run Composer is not found when running composer from a PASE shell.  

> composer                                   
  /QOpenSys/usr/bin/-sh: composer:  not found.
  $          

Environment

Zend Server for IBM i versions 2019 and higher, running on any supported version of IBM i

Resolution

Create a symlink called "composer" in /usr/bin that links back to the shell script that will run composer.  This will allow you to run the composer command anywhere in PASE, as long as the default PATH is not changed to exclude /usr/bin. 

From a 5250 command line, with a *SECOFR class user profile:

call qp2term

This brings you into the PASE shell.  First, test to see if you can run the composer command.  Simply type composer on the first line and press enter.  We expect it will not be found:

> composer                                    
  /QOpenSys/usr/bin/-sh: composer:  not found.
  $                                           

If instead you get the actual output from Composer, you don't need to continue.

If composer was not found, enter this command:

For version 2020 or higher:

ln -s /usr/local/zendphp74/bin/composer.sh /usr/bin/composer

For version 2019:

ln -s /usr/local/zendphp7/bin/composer.sh /usr/bin/composer

When you press enter the command should run right away:

> ln -s /usr/local/zendphp74/bin/composer.sh /usr/bin/composer
  $                                                           

Now test it by running the composer command again.  You should see some output that takes more than one page.  Page up a few times to see the start of the output:

 > composer                                           
      ______                                          
     / ____/___  ____ ___  ____  ____  ________  _____
    / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
   / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /    
   \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/     
                       /_/                            
   Composer version 2.0.7 2020-11-13 17:31:06         
                                                      
   Usage:                                             
     command [options] [arguments]                    
                                                      

Now you can run the composer command from anywhere. 

Important Note

This works because /usr/bin is in the default PATH.  If you change your PATH, please always remember to include the default path.  For example, if you want to add /QOpenSys/pkgs/bin to your path, you would do it like this:

> PATH=/QOpenSys/pkgs/bin:$PATH 
  $                             
> export PATH                   
  $                             

This makes sure you can continue to use all the things in the default path, including the composer command you just added to /usr/bin.




                            

  • No labels