Mensaje: PDFDocument: stream must have data

Hi!!
I’m new in OJS, and I am in a big problem because I upload OJS application to my cpanel and the moment when I want to open an issue or article
this give an error PDF error: Stream must have data, I set up the folder with permissions 777.
Please help me.
ojs

Hi @carla_noriega,

What OJS version are you using?
Do you see any relevant errors in PHP log when trying to access problematic PDFs?

I’m using 3.1.2. I supposed that the path is the problem because whe I try to load an issue or an article give me an error

Can you look at PHP logs for relevant errors? It may help to identify the problem.

I don’t see the full message. The relevant is the last one, If it contains something like failed to open stream: Permission denied, you’ll need to set permissions correctly: How should file permissions be set? - #2 by ctgraham

Also, what is the full line for “shell_exec() has been disabled” and “chmod() has been disabled”?

This is the all line, please help me.error3

It says “failed to open stream: The file or directory does not exist”

The line “shell_exec() has been disabled” indicates that your host has not installed the FileInfo module for PHP, but has also disabled executing system commands from PHP. As a result, OJS will likely be unable to determine the MIME type for uploaded files. Check with your host whether then can enable one or the other of these options. Both would be preferred.

For the line “move_uploaded_file(): unable to move”, this indicates that PHP could not write to files_dir directory to move the recently uploaded galley to the private files location. As Vitaly notes, you’ll want to check your file permissions to ensure your webserver is able to write to this location.

It also seems that your file_dir is configured within config.inc.php to be within your “public_html” root. Be sure that you have restricted access to this location, otherwise this represents a security risk. This directory must not be accessible publicly from the web.

Thanks!! But I did all that you explain me but the error is the same, Do you know how to change the patha because It is double //

error4

In Linux, the double slash does not make a difference.

The problem will be with the directory ownership and permissions on a subdirectory of /home/enterprisec/public_html/investigar/files/, or with the selinux context of that location, or of the PHP configuration (such as “open_baseurl”) to restrict write access to the location.

I changed the path of file_dir within config.inc.php to /home/enterprisec/files, but It doens’t recognise it, I set the permissions but It still continue with error shell_exec() and chmod()

When you changed the setting in config.inc.php for files_dir, did you also move the directory “files” from “public_html” to the “enterprisec” directory? Both actions will be needed.

What did you do in order to set the permissions on the files?

The shell_exec() and chmod() warnings will continue until you or your hosting provider changes your PHP configuration, specifically by disabling “safe_mode” in PHP 5, or configuring disable_functions in PHP 5 or 7.

Yes, I move the folder files from “public_html” to “enterprisec” directory, I set 755 permissions to the folder files.
But When I click on a pdf file this is opened in a new window but qhen I tried to upload a new one gives me that error…

You’ll need to check not only the numeric mode of the file permissions, but also the owner and group for the files_dir directory, and each subdirectory under that location.

As an example, what is the owner, group, and file permissions of:
/home/enterprisec/files/journals/2/articles/32/submission/proof/
?
(assuming you have moved the files_dir)

@carla_noriega, had this problem awhile ago and I was able to solve it through the hard way. The only way it can be solved is through the host. However, before you consider going back to the host, return the folder to public_html, then go to the public folder. Consider, 755 for files or 777. If that doesn’t work at all like it never worked for me before, tell the host to reset the cpanel settings. Make sure you back-up your all your files both on the softaculous and on the external means

Hi all,

777 permissions are never safe to use, though they can be helpful for debugging. Just be sure not to leave your permissions set that way.

Regards,
Alec Smecher
Public Knowledge Project Team