Error on uploading image on Journal Step 5

Hello all,

When uploading an image, I’m getting the following error mesage(s):

ojs2 has produced an error Message: WARNING: mime_content_type(/tmp/phpXnzvtX): failed to open stream: Arquivo ou diretório não encontrado In file: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php At line: 378 Stacktrace: File: (unknown) line (unknown) Function: PKPApplication->errorHandler(2, "mime_content_type(/tmp/phpXnzvtX): failed to open stream: Arquivo ou diretório não encontrado", "/var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php", 378, Array(3)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php line 378 Function: mime_content_type("/tmp/phpXnzvtX") File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/file/FileManager.inc.php line 92 Function: String->mime_content_type("/tmp/phpXnzvtX", "png") File: /var/www/revistas/instalacoes/ciinf-migracao/classes/manager/form/setup/JournalSetupStep5Form.inc.php line 153 Function: FileManager->getUploadedFileType("journalFavicon") File: /var/www/revistas/instalacoes/ciinf-migracao/pages/manager/SetupHandler.inc.php line 258 Function: JournalSetupStep5Form->uploadImage("journalFavicon", "pt_BR") File: (unknown) line (unknown) Function: SetupHandler->saveSetup(Array(1), Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPRouter.inc.php line 362 Function: call_user_func(Array(2), Array(1), Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPPageRouter.inc.php line 220 Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(1), False) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/Dispatcher.inc.php line 134 Function: PKPPageRouter->route(Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPApplication.inc.php line 178 Function: Dispatcher->dispatch(Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/index.php line 64 Function: PKPApplication->execute() Server info: OS: Linux PHP Version: 5.4.4-14+deb7u14 Apache Version: Apache/2.2.22 (Debian) DB Driver: mysql DB server version: 5.5.37-0+wheezy1

Hi @ramon,

What version of OJS are you using?

Regards,
Alec Smecher
Public Knowledge Project Team

It’s the latest OJS version.

Hi @ramon,

What image field are you trying to upload into?

Does your server have SELinux extensions enabled?

Regards,
Alec Smecher
Public Knowledge Project Team

Hello Alec,

I responded via cell, without access to the development server.
It’s the favicon field, and I’m trying to upload a PNG to it, as my Photoshop ICO Plugin is not working…

Here are more detailed OJS and server info:

2.4.6.0	2	4	6	0	19/03/2015
2.4.5.0	2	4	5	0	24/02/2015

As you can see, it’s an upgraded 2.4…0 to 2.4.6.0 version.
I don’t know what are (how many) or how to check for SELinux extensions…

OS platform	Linux
PHP version	5.4.4-14+deb7u14
Apache version	Apache/2.2.22 (Debian)
Database driver	mysql
Database server version	5.5.37-0+wheezy1

Hi @ramon,

I’ve just tested a copy here and it seems to work, so I suspect it’s a permissions problem over there. To check your SELinux status, see this thread:

Regards,
Alec Smecher
Public Knowledge Project Team

Hello Alec,

There seems to be something different about this server, as cat /etc/sysconfig/selinux or sestatus are not found…

Hi @ramon,

That probably means that your server doesn’t have SELinux extensions installed. That’ll remove one consideration from the problem.

I suspect the fact that you’re uploading a PNG is the problem – that’s mean to be an .ico and isn’t coded to handle conversions etc. between formats.

Regards,
Alec Smecher
Public Knowledge Project Team

Alec,

I uploaded an ICO image, which was uploaded as it shows up on the page, but still produces errors:

ojs2 has produced an error Message: WARNING: mime_content_type(/tmp/php0LtzSc): failed to open stream: No such file or directory In file: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php At line: 378 Stacktrace: File: (unknown) line (unknown) Function: PKPApplication->errorHandler(2, "mime_content_type(/tmp/php0LtzSc): failed to open stream: No such file or directory", "/var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php", 378, Array(3)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/String.inc.php line 378 Function: mime_content_type("/tmp/php0LtzSc") File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/file/FileManager.inc.php line 92 Function: String->mime_content_type("/tmp/php0LtzSc", "ico") File: /var/www/revistas/instalacoes/ciinf-migracao/classes/manager/form/setup/JournalSetupStep5Form.inc.php line 153 Function: FileManager->getUploadedFileType("journalFavicon") File: /var/www/revistas/instalacoes/ciinf-migracao/pages/manager/SetupHandler.inc.php line 258 Function: JournalSetupStep5Form->uploadImage("journalFavicon", "en_US") File: (unknown) line (unknown) Function: SetupHandler->saveSetup(Array(1), Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPRouter.inc.php line 362 Function: call_user_func(Array(2), Array(1), Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPPageRouter.inc.php line 220 Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(1), False) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/Dispatcher.inc.php line 134 Function: PKPPageRouter->route(Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/lib/pkp/classes/core/PKPApplication.inc.php line 178 Function: Dispatcher->dispatch(Object(Request)) File: /var/www/revistas/instalacoes/ciinf-migracao/index.php line 64 Function: PKPApplication->execute() Server info: OS: Linux PHP Version: 5.4.4-14+deb7u14 Apache Version: Apache/2.2.22 (Debian) DB Driver: mysql DB server version: 5.5.37-0+wheezy1

Hi @ramon,

Unfortunately I still can’t duplicate this behavior locally. Is this happening when you hit the Upload button next to to the favicon field, or when you save the Step 5 form, or something else?

Regards,
Alec Smecher
Public Knowledge Project Team

Alec,

This happens when I upload the file, from the upload favicon field.
After saving Step 5, the message disappears.

Hello Alec,

I’m not sure if it’s relevant, but display_errors and show_stacktrace are On… It’s a development server, so, if any errors exist, we should know and fix them before going live, even if they don’t seem to cause any harm.

I would hate for such things to crawl back and bite us …

Hi @ramon,

I still can’t duplicate this behavior locally – but if it seems to be working despite the warning, I’d suggest either spending some time debugging it locally or ignoring it. The risk of this affecting the journal is very low.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @ramon,

Just a note that Bozana at Free University Berlin has encountered and fixed this problem. See Error on favicon upload, when determining the favicon type · Issue #464 · pkp/pkp-lib · GitHub for details.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello Alec,

Thanks for the update.
I got lost on the amount of links and can’t find the patch… We can’t use Github, as it is blocked by our fireleak… as it only blocks good things…

I mean, I visited the Recomended Patches page, but I’m not sure if I must use all the links in there… there is no bug listing as in previous versions…

Hi @ramon,

You can get the patch e.g. here:
https://github.com/bozana/ojs/commit/a3d265c4d02ddec55b56a41927aadc402be1361e.diff

Unfortunately it’s only available on github, but it’s a very short patch if you want to grab it e.g. via mobile data.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you Alec,

I changed the line accordingly (didn’t apply the patch though…).