• 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I just spun up an Ubuntu 14.04 VM on HPCloud.com to practice Chef.

Following this turial I setup a DNS on HPCloud, as well as set the hostname in /etc/hosts to chef-server.mydomain.com

When running

chef-server-ctl user-create user_name first_name last_name email password --filename FILE_NAME

I'm getting

ERROR: Connection refused connecting to, retry 1/5

It retries 5 times and fails. What's wrong with my setup?

I was tempted to ask you this on the comments but I thought I could elaborate more in the answer section with a potential fix.

So, when you have a connection refused on any service, not just Chef, check that the service is doing what it should be. So I assume you took apache 2.x cookbook and installed it correctly, yes?

Stage 1:

If so, issue:

netstat -anp | grep :443 # or whatever your designated HTTP/HTTPS port is.

and if you see it, great, service is running and has opened the port, proceed to Stage 3. If the service hasn't opened the port, proceed to Stage 2.

Stage 2:

Make sure that you either configure SELinux to allow for a service to spawn-open a port.


and then;

semanage port -a -t http_port_t -p tcp 443

You can always check if SELinux is enforcing or disabled in the SELinux configuration file.

If SELinux is disabled, then check whether you have iptables running and if so, issue the command (assuming port 443 is your HTTPS port):

 iptables -A INPUT -p tcp --dport 443 -j ACCEPT

or if you use firewalld

    firewall-cmd --zone=public --add-port=443/tcp --permanent

Stage 3:

Do you have permission to view the directory /users? You did not specify an HTTP error number, so I assume that whatever you are trying to do is refusing the connection, possibly due to permissions.

Remember that the Chef command you are using is trying to create a user, you could try sudo if you're not root also!

Another error that could be possible is checking your SSL settings and making sure that you have allowed to be viewed by

Apache 2.4 has different rules and not the old fashionable "allow order"

You could test with this to see if it works:

Require host address #Change as necessary
Require ip ip.address #Change as necessary


Require all granted
Require not ip # This denies IPs

Finally, if none of this works, then check your httpd log files, they are your last resort...well...google is..

  • 2
Reply Report

I had the same problem, but on a vagrant VM that I made for testing. How I solved it:

  1. Edit /etc/hosts and add your server's hostname (so nginx sees it as a fully qualified domain name).
  2. Run chef-server-ctl reconfigure
  3. Run chef-server-ctl status to make sure all the processes are running (none should say down. If one is down, try running chef-server-ctl restart).
  4. Run your chef-server-ctl user-create... command again.
  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags