Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting path variable for apache user on Amazon Ec2

I've been on this for a good few hours and I'm not getting anywhere.

I can't add /usr/local/bin to the apache users PATH variable. The user doesn't have a .profile, I can't su to the user, I can't export to the PATH from php using exec and adding

SetEnv PATH /usr/local/bin

To either the http.conf or the .htaccess file doesn't make a difference. I can't find the envvars file to change that but I suspect there's some other problem.

I have restarted apache, and indeed my server.

Any help please?

like image 221
Michael Mallett Avatar asked Jan 13 '14 12:01

Michael Mallett


People also ask

Where is user data stored on EC2?

When a user data script is processed, it is copied to and run from /var/lib/cloud/instances/ instance-id / . The script is not deleted after it is run. Be sure to delete the user data scripts from /var/lib/cloud/instances/ instance-id / before you create an AMI from the instance.

Where is Java path on AWS Linux?

Run the file command on that location /etc/alternatives/java . You can re-affirm the location running file command on the symbolic path: $ file /usr/lib/jvm/java-8-openjdk. x86_64/bin/java /usr/lib/jvm/java-8-openjdk.


1 Answers

Ended up following what Alfe suggested in his answer, except rather than in the /etc/init.d/httpd file (which could be overwritten easily on update) I added to /etc/sysconfig/httpd:

export PATH=${PATH:+$PATH:}/usr/local/bin

like image 179
Michael Mallett Avatar answered Nov 15 '22 05:11

Michael Mallett