Ask Your Question

Authenticate openstack shell commands from PHP

asked 2016-11-15 07:17:48 -0500

devmitaka gravatar image

updated 2016-11-23 14:19:02 -0500

zaneb gravatar image

Hi all,

I am trying to create a stack from my browser using a simple PHP shell_exec() command. However, it is giving me the error :

Missing value auth-url required for auth plugin password

The php code is as follows:


$exec = shell_exec("source keystonerc_admin");
$exec = shell_exec("openstack stack create --template /home/admin/HEAT-TEMPLATES/ TestStack 2>&1"); 



echo "Done!!\n\n";
echo "<pre> $exec </pre>";


The error remains the same with or without sourcing the keystonerc_admin command. I have tried to add the --os-user-id, --os-password and the --os-auth-url options with the stack creation command but I am still facing errors.

What should I do to execute openstack commands from a browser? Any pointers would be greatly appreciated.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-11-15 23:07:02 -0500

I'm not positive but I believe the error may line in the 2 separate exec statements.....

exec #1 sources the env finisheds and closes exec #2 runs your openstack create command missing env variables....

try something like this:

$exec = shell_exec(source keystonerc_admin; "openstack stack create --template /home/admin/HEAT-TEMPLATES/ TestStack 2>&1");
edit flag offensive delete link more


Tried it already. it didnt worked. Sourcing the keystonerc_admin gives an error that sh: line 0: .: file not found . Permissions on it are all fine (777). I have also tried the openstack stack create with other as stated but it didnt worked. Native shell commands work fine too

devmitaka gravatar imagedevmitaka ( 2016-11-16 03:55:02 -0500 )edit

tried giving full path to file starting from / ? or placing file in / to see if that worked?

bcollins gravatar imagebcollins ( 2016-11-17 14:04:03 -0500 )edit

answered 2016-11-16 23:59:21 -0500

silently gravatar image

maybe the problem is ( shell_exec function) create new process ,after executive ,then exit, no transfer environment to next line .

try this:

$exec = shell_exec("source path/to/keystonerc_admin;openstack stack create --template /home/admin/HEAT-TEMPLATES/ TestStack 2>&1");
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-11-15 07:17:48 -0500

Seen: 770 times

Last updated: Nov 23 '16