Warning: fopen..: failed to open stream in opening a DOC file

Warning: fopen..: failed to open stream in opening a DOC file

by Alberto Montoto -
Number of replies: 9

Hi @Visvanath,

Now I have another issue: when clicking on a course to download, the file download without problem, but when trying to open it, it shows an error:

This message below is displayed in MS Word, when opening a .doc file

<br />
<b>Warning</b>:  fopen(/home/ecampus/public_html/ecampusdata/filedir/9f/49/9f49cfbda2ecec42a7e6d44b7f1e4daa53f97830): failed to open stream: No such file or directory in <b>/home/ecampus/public_html/ecampus/lib/filestorage/file_system.php</b> on line <b>559</b><br />
<br />
<b>Warning</b>:  ini_set(): Cannot change zlib.output_compression - headers already sent in <b>/home/ecampus/public_html/ecampus/lib/filelib.php</b> on line <b>2695</b><br />
See also attached screenshot when opening a .pdf file

Looking forward to receiving your advice.

Attachment Acrobat_Error.png
Average of ratings: -
In reply to Alberto Montoto

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators

Hi

You should talk to your hoster. Some security mechanism he has activated is not compatible with Moodle. One possibility is a rule in SELinux. Another is an Apache open_basedir restriction.

You are probably new to forums. We open a new discussion for a new issue. And give them subject lines. (Notice that I already gave the discussion a new subject. The moderators here are so kind and hide forum Dos and Don'ts, but not always give the best results. ;)

In reply to Visvanath Ratnaweera

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Alberto Montoto -
Could you be a little more specific?
What rule, should I ask the hosting company to check, for SELinux, or what's the Apache open_basedir restriction to set (it's currently disabled)?
In reply to Alberto Montoto

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Ken Task -
Picture of Particularly helpful Moodlers

Since you have CLI access, command for SeLinux to check if it's running and in what mode (enforcing/permissive/disabled) is:

/usr/sbin/sestatus

Can be executed only by root user.

open_base directory is a php setting and should be found in the php.ini file:

fgrep 'open_base' /etc/php.ini

; open_basedir, if set, limits all file operations to the defined directory
;open_basedir =

you can see on server am using both lines have ';' in front which means they are not active .... commented out ... thus no rule for open_basedir is in affect.

'SoS', Ken




In reply to Ken Task

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Alberto Montoto -
SELinux status is disabled and open_basedir same like yours, which means disabled too
In reply to Alberto Montoto

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Ken Task -
Picture of Particularly helpful Moodlers

Issue the following commands and share back the text responses, please

As root user in the VPS

uname -an

env |grep 'PATH'

Next one will probably render quite a bit of text:

find /opt/ -name php

Following related to apache config ...

cd /etc/httpd/conf.d

Is there a php.conf file there? ls to find out.

If so, fgrep 'AddHandler' php.conf

And ... last one ...

cd /path/to/moodlecode/admin/cli/

ls -l cron.php

'SoS', Ken


In reply to Ken Task

Re: Warning: fopen..: failed to open stream in opening a DOC file

by Alberto Montoto -
Well, the issues have been fixed, by simply reimporting the database again.
Apparently first time importing it, it came corrupted.
Thanks Ken for the troubleshoots anyway; they helped me to see where the problem could be. Thanks again
In reply to Alberto Montoto

Re: Issues after Server Migration

by Ken Task -
Picture of Particularly helpful Moodlers

First, your data directory is inside the code directory ... am guessing Softac install or work around for base_dir setting not allowed outside of code ...

What's in your config.php file for path to moodledata?

Use whatever tool you have to browse files and look in

/ecampusdata/filedir/9f/49/

For a file by the name of:

9f49cfbda2ecec42a7e6d44b7f1e4daa53f97830

copy that file out to a file you name with a .pdf extension to your ecampus/public_html/ directory ... like test.pdf

Then try your browser url directly to test.pdf

https://yoursite/test.pdf

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Issues after Server Migration

by Alberto Montoto -

Hi Ken,

Cannot open the file either; please see attachment.

Attachment File_Dont_open.png
In reply to Alberto Montoto

Re: Issues after Server Migration

by Ken Task -
Picture of Particularly helpful Moodlers

Well, that's 'special'!  Since you found your servers logs now what does it say in your error log when attempting to access that file directly via URL?

'Something went wrong.' isn't very helpful ... error logs might actually give an error number  ... like 500 or 404 etc.

Sent you a private message on moodle here ... please respond to that via PM.

'SoS', Ken