If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

AnnouncementAnnouncement Module

Collapse

myhosting.com Forum Guidelines

Welcome to the myhosting.com Forums! The purpose of this forum is to allow you to discuss topics relating to hosting and topics of interest with other myhosting.com 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 CustomerSupport. 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.

Permission problem: PHP function ftp_connect not enabled?

2012-05-07, 07:35 PM

Hi there,

I'm trying run a Contao Web CMS www.contao.org 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 myhosting.com (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:

Code:

Fatal error: Uncaught exception Exception with message Could not connect to the FTP server thrown in /usr/local/pem/vhosts/113951/webspace/httpdocs/mydomain.biz/system/libraries/FTP.php on line 104

Is there anyone who has an idea how to solve this problem? I would be so... )))))))))

Comment

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

Comment

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.

Comment

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 myhosting.com. He just didn't anwer when i asked how to do that

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.

Comment

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.