FATAL ERROR: File could not be opened.

16 years 6 months ago #46235 by joejvghack
FATAL ERROR: File could not be opened. was created by joejvghack
If you try and save the CB cofiguration file in the backend of Joomla, even without making any changes, the error in the subject of this post is recceived.

It appears that admin.comprofiler.controller.php has a function called saveConfig that checks if a class called JFile (Joomla: file.php), is callable. It is not. If it is not, the script attempts to see if ue_config.php can be opened and is writeable. If so, it writes a variable in the script called $txt, which is being initialized to all blanks (still checking why) to the config file which is why it gets changed to all blanks. The only change I made to CB since this was working was to install the CB Contacts component for CB 1.1 from the CB paid members area.

I am using Jooma 1.0.13 Stable and CB 1.1 Stable with the CB Contacts 1.1 component.

Post edited by: joejvghack, at: 2007/09/20 21:11

Please Log in to join the conversation.

16 years 6 months ago #46254 by beat
You need to set the permissions of file:

administrator/components/com_comprofiler/ue_config.php

to something which makes it writable by your apache process. 777 will work in all cases, but often 660 (rw-rw----), 770 or 600 is enough, depending on file owner.

I changed the error message for next release to give the hint to solution:

ERROR: Configuration file administrator/components/com_comprofiler/ue_config.php could not be written by webserver. Please change file permissions in your web-pannel.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

16 years 6 months ago #46267 by joejvghack
Replied by joejvghack on topic Re:FATAL ERROR: File could not be opened.
Hi Beat,

Something else is amiss here. I have a lot of servers so I installed everything fresh. By fresh I mean entire web site with defaults and only admin as user. Joomla 1.0.13, CB 1.1. No problem saving the configuration file. I am going to install the CB 1.1 component I mentioned in previous post and see what happens next.

Please Log in to join the conversation.

16 years 6 months ago #46271 by beat
if you install CB with joomla installer, usually file ownership is apache, and ue_config.php is writable.

If you install/replicate things via ftp/mysql, owner is usually NOT apache, so it can't write, and you need to set ue_config.php to writable by apache for the config to work.

Your hoster can help you to do that, sometimes, they are only ones which can change file ownerships.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

16 years 6 months ago #46321 by joejvghack
Replied by joejvghack on topic Re:FATAL ERROR: File could not be opened.
Hi Beat,

Thanks for your help. I reinstalled CB 1.1 Contacts component and the file is still being saved. I agree with your observations; there is no bug. But I still question why is_writable($configfile) returned true and if ($fp = fopen( $configfile, "w")) returned false in admin.comprofiler.controller.php - function: saveConfig.

As an FYI, PHP Bug #27609: is_writable returns true for file that can not be written to, is all that I have found that appears to be related to this - bugs.php.net/bug.php?id=27609. I run CB 1.1 in a Windows XP SP2 environment which this addresses. I have run into this before, and used ATTRIB, IIS permissions, etc. but never resolved the problem.

I saved the old ue_config.php file and I am able to reproduce this now. I have looked at the two files and as far as security, they appear to be identical. When I first saw the error - no indications of ownership or security problems existed then either. As you said, if I copy the file to the same location and delete the original, the error appears again. However you cannot see anything different from the original file as far as security goes using ATTRIB, IIS Admin, etc. Also, since I am a developer, I know now that I accidentally pushed this file from my development site to my test area which is what caused the original problem and I just reproduced it also.

Since this is outside the use of the package we can close this. This is between me and Windows at this point. :o)

I was able to XCOPY the file from the command line with a /O switch; I did not think of that until now. This will copy file ownership and ACL information and as you said, that's the problem and XCOPY corrects it. However, this assumes you have the original file from the Joomla installation. You can copy from the original CB 1.1 package without going through the Joomla installation as there is a Windows XP SP2 utility called Cacls.exe which allows you to change the owner from what it is now to what Windows wants (at least in my case), IUSR_ followed by machine name (IIS 5.0 default). This is not recommended for a novice user, but it solves my problem as I am frequently copying files on my local environment and this research answered my long time question - how do you correct this in a Windows environment?

Post edited by: joejvghack, at: 2007/09/21 21:43

Please Log in to join the conversation.

16 years 6 months ago #46481 by beat
joejvghack wrote:

Hi Beat,

Thanks for your help. I reinstalled CB 1.1 Contacts component and the file is still being saved. I agree with your observations; there is no bug. But I still question why is_writable($configfile) returned true and if ($fp = fopen( $configfile, "w")) returned false in admin.comprofiler.controller.php - function: saveConfig.

As an FYI, PHP Bug #27609: is_writable returns true for file that can not be written to, is all that I have found that appears to be related to this - bugs.php.net/bug.php?id=27609. I run CB 1.1 in a Windows XP SP2 environment which this addresses. I have run into this before, and used ATTRIB, IIS permissions, etc. but never resolved the problem.

I saved the old ue_config.php file and I am able to reproduce this now. I have looked at the two files and as far as security, they appear to be identical. When I first saw the error - no indications of ownership or security problems existed then either. As you said, if I copy the file to the same location and delete the original, the error appears again. However you cannot see anything different from the original file as far as security goes using ATTRIB, IIS Admin, etc. Also, since I am a developer, I know now that I accidentally pushed this file from my development site to my test area which is what caused the original problem and I just reproduced it also.

Since this is outside the use of the package we can close this. This is between me and Windows at this point. :o)

I was able to XCOPY the file from the command line with a /O switch; I did not think of that until now. This will copy file ownership and ACL information and as you said, that's the problem and XCOPY corrects it. However, this assumes you have the original file from the Joomla installation. You can copy from the original CB 1.1 package without going through the Joomla installation as there is a Windows XP SP2 utility called Cacls.exe which allows you to change the owner from what it is now to what Windows wants (at least in my case), IUSR_ followed by machine name (IIS 5.0 default). This is not recommended for a novice user, but it solves my problem as I am frequently copying files on my local environment and this research answered my long time question - how do you correct this in a Windows environment?

Post edited by: joejvghack, at: 2007/09/21 21:43


Cool, happy that you solved the problem B)

Thanks also for sharing your solution.

Of course, another solution is to use Linux :laugh:

But I fully understand that sometimes that's not practicable for reasons beyond your contral ;)

+ Linux requires you often to have root priviledges to make an ownership change, which is not given to all web-hosting solutions.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.196 seconds

Facebook Twitter LinkedIn