CodeIgniter Forums
ERR_CONNECTION_REFUSED on the tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: ERR_CONNECTION_REFUSED on the tutorial (/showthread.php?tid=68917)



ERR_CONNECTION_REFUSED on the tutorial - rperezalo - 09-13-2017

Hi!

My name is Raúl and this is my first post here, in this case my first problem.

I've finished the CodeIgniter tutorial with MAMP and I have this error:

The [:: 1] page has refused the connection.
ERR_CONNECTION_REFUSED

twice: when I clic the link "View article" (News section) and when I clic the button "Create news item".

If somebody has had the same problem and he or she has found the solution, please tell me what can I do.

Thank you very much,
Raúl


RE: ERR_CONNECTION_REFUSED on the tutorial - ciadvantage - 09-13-2017

check your database config file such as config/database.php
I assume that you click on those links then it should perform some queries to get you results then output to the view


RE: ERR_CONNECTION_REFUSED on the tutorial - rperezalo - 09-13-2017

Hi ciadvantage! Thank you for your answer.

I can see the news, so I assumed that there isn't any problem with the DB. I followed all the tutorial step by step and the only problem is about that connexion error.


RE: ERR_CONNECTION_REFUSED on the tutorial - Narf - 09-13-2017

It's not a DB problem. Your web server is not responding on that address/port.

Either it crashed, or you set it up on a custom port, but then didn't set that in your base_url in the CI config.


RE: ERR_CONNECTION_REFUSED on the tutorial - rperezalo - 09-14-2017

Hi Narf Smile

YEAH!!! That was the problem! I didn't put anything in my base_url.

Thank you very much for your help!!!


RE: ERR_CONNECTION_REFUSED on the tutorial - carlospinedat - 03-09-2022

===== English =====================
wow I can't believe I'm replying to this old post... but I hope the following will help someone.

I have this piece of code in: config/config.php in $config["base_url"]

PHP Code:
$root = (isset($_SERVER["HTTPS"]) ? "https://" "http://") . $_SERVER["HTTP_HOST"];
$root .= str_replace(basename($_SERVER["SCRIPT_NAME"]), ""$_SERVER["SCRIPT_NAME"]);
$config["base_url"] = $root

Regardless of whether it is on the server or local, it dynamically takes the main path of the site. I hope that helps


===== Español =====================

wow, no puedo creer que esté respondiendo a esta publicación tan vieja... pero espero que lo siguiente ayude a alguien.

Tengo este fragmento de código en: config/config.php en $config["base_url"]

PHP Code:
$root = (isset($_SERVER["HTTPS"]) ? "https://" "http://") . $_SERVER["HTTP_HOST"];
$root .= str_replace(basename($_SERVER["SCRIPT_NAME"]), ""$_SERVER["SCRIPT_NAME"]);
$config["base_url"] = $root

Independientemente de si está en un servidor o local, toma dinámicamente la ruta principal del sitio.

Espero que eso ayude a alguien


RE: ERR_CONNECTION_REFUSED on the tutorial - kenjis - 03-10-2022

Check the hostname is valid. If not, it is vulnerability.
See https://forum.codeigniter.com/thread-67878.html


RE: ERR_CONNECTION_REFUSED on the tutorial - Kenn38 - 03-10-2022

Found some useful thoughts: https://tipsfordev.com/err-connection-refused-in-codeigniter-s-tutorial