Cannot copy apache configuration file during build


#1

I’m trying to set up a build using the instructions provided here:
https://circleci.com/docs/language-php/#php-apache

When the build tries to copy the file it outputs the following:

cp ~/core/apache_ci.conf /etc/apache2/sites-available

cp: cannot create regular file ‘/etc/apache2/sites-available/apache_ci.conf’: Permission denied

cp ~/core/apache_ci.conf /etc/apache2/sites-available returned exit code 1

Action failed: cp ~/core/apache_ci.conf /etc/apache2/sites-available

I tried a separate build where I catthe file which succeeded and cd into the directory successfully.

Any help would be appreciated.


#2

Try prefixing the commands with sudo since you are doing work outside of the user directory.

So instead of:

cp ~/core/apache_ci.conf /etc/apache2/sites-available,

it would be:

sudo cp ~/core/apache_ci.conf /etc/apache2/sites-available.


#3