title: CodeIgniter FTP connection error
body: <p>I am trying to connect to my FTP server using CodeIgniter FTP Class. What I want to do is to just display a success message when the connection is successful and display an error message if an error occurs. I have found that the <code>$this-&gt;ftp-&gt;connect()</code> function returns <code>1</code> for successful connection. But when an error occurs it takes me to the error page instead of displaying the error message.</p>
  
  <p><a href="https://i.stack.imgur.com/0sgij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0sgij.png" alt="enter image description here"></a></p>
  
  <p>Here is my code: </p>
  
  <pre><code>$this-&gt;load-&gt;library('ftp');
  $config['hostname'] = 'ftp.example.com';
  $config['username'] = 'your-username';
  $config['password'] = 'your-password';
  $config['debug']    = TRUE;
  if ($this-&gt;ftp-&gt;connect($config)) {
      echo "success!";
  } else {
      echo "error!";
  }
  </code></pre>
  
  <p>Any suggestion on how I can handle this error will be really helpful.</p>