Announcement Announcement Module
Collapse Forum Guidelines

Welcome to the Forums! The purpose of this forum is to allow you to discuss topics relating to hosting and topics of interest with other Customers. The primary focus should relate to issues not generally included in our Wiki or Control Panel, or information not provided by our Customer Support Team. Some examples include programming and coding support, web site design ideas and SEO practices.

The forum is not meant as a replacement to our Wiki or Customer Support. We highly recommend searching our Wiki before posting on the forum. Also, if you have a question for our Customer Support team, please contact them as you would normally.

We ask that if you have any complaints or questions relating specifically to your account, that you address them to our Customer Support department. Do not post personal account information such as passwords or other sensitive and private information the forum, as this type of information is best kept secret. Also, please be respectful of other users and refrain from defamatory comments or use of coarse language.

We will visit the forum from time to time, and contribute to various topics. We reserve the right to delete any posts which are deemed offensive or against the spirit of the forum. Any spamming or illegal activity will not be tolerated. We also reserve the right to block any user who violates these guidelines.

To get started, we welcome you to sign up at our User Management site. Any account created there will have access to these forums, our Wiki, our Ideas site and commenting permission on our Status Blog.
See more
See less
Permission problem: PHP function ftp_connect not enabled? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Permission problem: PHP function ftp_connect not enabled?

    Hi there,

    I'm trying run a Contao Web CMS on a Business Hosting and Email account.
    The installation fails because Contao is not able to modify files by itself, so the configuration file is not writable. (this should be a permission problem). I think this problem is also well-known from Wordpress, especially when trying to install plugins.

    The official solution is, providing FTP connection data for Contao. I did this many times, it's the best working solution for all webhosters i've tried so far. But not now

    I asked for help in the german Contao support Forum and just got to know, that the PHP function ftp_connect is not enabled on (or some account types) Is that true???

    Enabling this funtion might solve my problem. I already tried to contact the support via ticket - but my ticket disappeared and never got answered. Phone support also wasnt very helpful, i wasted my time explaining, that i'm not talking about a FTP connection using my desktop client! (i have no problems doing that, btw)

    Error message in browser window:
     Fatal error: Uncaught exception Exception with message Could not connect to the FTP server thrown in /usr/local/pem/vhosts/113951/webspace/httpdocs/ on line 104
    Is there anyone who has an idea how to solve this problem? I would be so... )))))))))

    Many thanks, Annika

  • #2
    Hi Annika,

    I've submitted your problem to myhosting staff. I hope that they will help you as soon as possible.



    • #3
      Hi There,

      Can you clarify if you're on a Windows or Linux shared hosting? Our Business plan comes in both "flavors".


      • #4
        I've tested with both Windows and Linux shared hosting and it does seem to fail on both. I'm still looking into the issue and discussing some ideas internally. I will try to get back to you soon with more info. In the meantime, it would still be helpful to know if you're on Linux or Windows


        • #5
          Just an update: ftp_connect itself should function. The issue is that we do block outbound FTP from the server, so this is why it will fail. This was done for various security reasons, like preventing abuse by script-kiddies using our servers for scanning.

          It is possible that it could be opened up, but it's problematic because FTP is a fairly messy protocol requiring many ports.


          • #6
            Hello Tim,

            many thanks for the support! I'm not sure, if it's really the ftp_connect function, but a user in the german Contao forum came up with that idea - he had the same problem 3 years ago, but obviously it was solved - his website is still running on He just didn't anwer when i asked how to do that

            PHP Version 5.2.17
            System Linux 2.6.18-274.3.1.el5 #1 SMP Tue Sep 6 20:13:52 EDT 2011 x86_64

            The CMS is located in a subfolder of webspace/httpdocs. I created a wildcard subdomain (for testing purposes) and a FTP user pointing to that directory. This is also the FTP user a wanted to use for Contao - but i tried the root FTP user as well.

            If you send me a PM to reply, i could also send you the link to domain & check tool.

            Best regards, Annika


            • #7
              Hello Annika,

              Can you explain what the FTP function does with this CMS? Describing a valid use-case might help convince us to open up the port(s) on the firewall.


              • #8
                Hello Tim, i'll try to explain:

                Providing FTP data for Contao is known as the so-called "Safe-Mode"-Hack"

                Here's an excerpt from the Contao installation guide:

                The term "Safe Mode Hack" is actually misleading, because it implies that the problem was caused by the PHP safe_mode. However, it is caused by insufficient file permissions and can occur even if safe_mode is disabled, so it should be called "File Permission Hack" instead. PHP as an Apache module is typically run as wwwrun, www-data or nobody, whereas the files that you uploaded via FTP belong to you (e.g. web4 or ab5678). The server therefore denies the PHP script Contao access to those files.

                To work around the permission problem, Contao establishes an FTP connection to modify files and folders. All you have to do is to enter your FTP login details in the local configuration file (system/config/localconfig.php).

                A typical case for modifying files occurs, when installing plugins from the extension repository.
                The most important file to write in is the localconfig.php, which is similar to the wp_config.php in Wordpress, or settings.php in Drupal. Contao and many plugins use that file to store their settings. Changing settings won't be possible without write permission.

                The localconfig.php also collects all data entered during the installation process. After a successful installation, it contains the database connection data, the ftp-connection data, install password (encrypted) and some website-specific data like title or version number.

                Another case might be: creating folders and upload files with the file manager. Contao creates cache files of every uploaded image, which also requires write access to a temp-folder.

                I hope this was helpful for the decision

                Best regards, Anika


                • #9
                  Hi Annika,

                  Can you try this once again? Even though FTP is blocked (outbound) on the firewall, if you are making the ftp connection locally (i.e. to your own hosting account) it should work.

                  I have a simple test script on another account on the same shared hosting node, and it is currently functioning properly.


                  • #10
                    Tim!! It works!!!

                    I could complete installation and everything works as intended. I can upload files and change settings...

                    Many thanks for the help! Have a nice day.

                    Regards, Anni


                    • #11
                      Thanks! I'm glad it's fixed!