Domanda

I am trying to run php script via execute shell in Jenkins but it seems i am missing something.

here is my command in execute shell of Jenkins

#!/usr/bin/php

php /home/admin/reports/test.php"

I am not getting any error in console output.

and when i try these commands:

#!/bin/bash    
php /home/admin/reports/test.php"

then I get error which says failed to open stream: Permission denied in /home/admin/reports/test.php" .

È stato utile?

Soluzione

Jenkins, with default installation, will be run under jenkins user. That user has no access to your /home/admin home directory. The Permission denied is pretty self-explanatory.

  • Either give jenkins user read access to /home/admin (not recommended)
  • Or place the file into /home/jenkins directory (not best solution either)
  • Or better yet, have the file available in shared location accessible by both, preferably the job's workspace that is populated through the SCM (recommended).
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top