We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Blank $HOMEDIR Variable when calling cli via php exec() function
Blank $HOMEDIR Variable when calling cli via php exec() function
I have written a custom bash script which is called by php with root permissions via sudoers. The bash script adds a web domain with letsencrypt support.
My PHP my command is
My shell script is:
In my scenario, this is the best way for me to perform these functions (rather than using the vesta web api.)
After some testing because it wasn't working, I discovered that the $HOMEDIR variable in the v-add-web-domain script was blank, and that the web domain was being created in /admin/web/ NOT /home/admin/web/.
My question is how is the $HOMEDIR variable being set, and why is it blank in the above scenario?
My PHP my command is
Code: Select all
exec("sudo -u root /var/tuilder/bin/vestacp_add_domain.sh example.com 104.xxx.xxx.xx");
Code: Select all
#!/bin/bash
domain=$1
ip=$2
/usr/local/vesta/bin/v-add-web-domain admin $domain $ip www.$domain
/usr/local/vesta/bin/v-add-letsencrypt-domain admin $domain www.$domain
After some testing because it wasn't working, I discovered that the $HOMEDIR variable in the v-add-web-domain script was blank, and that the web domain was being created in /admin/web/ NOT /home/admin/web/.
My question is how is the $HOMEDIR variable being set, and why is it blank in the above scenario?
Re: Blank $HOMEDIR Variable when calling cli via php exec() function
Solved the problem.
The environmental variable $VESTA was set in the php exec environment.
Solved by doing this:
exec("VESTA='/usr/local/vesta' sudo -u root /var/tuilder/bin/vestacp_add_domain.sh example.com 104.xxx.xxx.xx");
The environmental variable $VESTA was set in the php exec environment.
Solved by doing this:
exec("VESTA='/usr/local/vesta' sudo -u root /var/tuilder/bin/vestacp_add_domain.sh example.com 104.xxx.xxx.xx");