Jump to content

Errors on saving page with images


verdeandrea
 Share

Recommended Posts

Hi guys,

i've moved a PW site from an hosting to an other. 

Now everytime i try to edit and save a page with and image field I get this errors

Notice: No file uploaded in Unknown on line 0

Notice: No file uploaded in Unknown on line 0

Warning: Cannot modify header information - headers already sent in /var/www/html/mysite/wire/core/admin.php on line 14

Warning: Cannot modify header information - headers already sent in /var/www/html/mysite/wire/core/Session.php on line 464

Warning: Cannot modify header information - headers already sent in /var/www/html/mysite/wire/core/Session.php on line 465

But if I reload the page i can see that the page's been actually edited and saved.

I checked Chrome Developer Tool but there is no error there.

If i set debug to false from config.php i see only the first two errors.

I tried solutions suggested on this forum (initOldSchool(), changing .htaccess, setting directories permissions, checking logs directory, empty session directory, checking if config.php has some empty lines in the beginning) but i had no luck.

Pw version is 2.5.3 and PHP version is 5.4.34

Can you please help with this? Thanks!

Link to comment
Share on other sites

sounds like directory / file access failures!

Have you checked / doublechecked the settings for site/assets/files/... and all subfolders and files? Is PHP / PW able to modify / save / delete files there?

Are all your files from the old hosters site are moved into the new one, or are there some missing?

  • Like 1
Link to comment
Share on other sites

I've just checked and permissions for the files folder were ok. I tried also to change them to 777 but i still have the same error. 

I tried to create a new template with a new image field and it still gives me this error when i save, even if i don't upload any image and i left the field blank.

This happen only with images/file fields. I don't get any error if i don't have image fields.

All filed from the old hoster should be in the new one. But i don't know if there's a way to check it for sure.

What else should i check?

Link to comment
Share on other sites

You should check it manually for one page.

Go to a problematic page with an images field that must have an image (from the old hoster). Look at the Page-ID (you see it in the browsers status bar when hovering over the tabs on top: http://example.com/processwire/page/edit/?id=1234....

Then go ()via FTP) to site/assets/files/1234/ and look into the folder what files and variations are in there, and also what access settings are applied.

When you above said you also tried 777, how have you done that? You know that it doesn't work onyl to change the settings in the site/config.php, yes?

You need to set it in the filesystem on the new host! Via FTP, set all site/assets/ directories incl. subdirectories and all files to the needed access settings for PHP user on that server! This is nothing what has to do with PW nor what you can handle with PW. You need to do it manually.

  • Like 1
Link to comment
Share on other sites

Thanks Horst,

yes, I know that. I changed folder and files permissions manually. I changed them using ftp software.

I've done as you said, i've checked the file folder of my page and the image is there. The file has 777 permissions, the id directory has 777 permissions and "files" directory has 777 too. I had applied 777 to all assets folder (just for test, i'll change it later) but still no luck.

  • Like 1
Link to comment
Share on other sites

When viewing your PHP Notice from the first post, this is nothing coming from PW, it looks like coming directly from PHP.  (I have scanned the PW 2.5 wire files for a part of that phrase!)

Also, I don't get why it every time you save, speaks about upload? What modules and third modules are active on that site?

  • Like 1
Link to comment
Share on other sites

@verdeandrea: This notice is shown when PHP was compiled with Zend debugger enabled and an empty file field is submitted. The best course of action would be to install a non-debug build of PHP. Temporarily, a possible workaround might be to disable E_NOTICE warnings by setting "error_reporting(E_ALL & ~E_NOTICE);" in site/config.php.

  • Like 3
Link to comment
Share on other sites

@horst This are my active modules:

FieldtypeConcat
FieldtypeMapMarker
FieldtypeSelect
InputfieldCKEditor
ProCache
ProcessDatabaseBackups
ProcessExportProfile
TextformatterVideoEmbed
ProcessTemplateSetupBatcher.module

@BitPoet: Thanks. I've tried putting 

error_reporting(E_ALL & ~E_NOTICE);

at the end of my site/config.php file, but nothing changes.
I'll ask to my hosting provider if there is a debug build of php installed. Can i also check this by myself using phpinfo() or something else?

Link to comment
Share on other sites

On 1/09/2016 at 4:41 AM, verdeandrea said:

I've tried putting 


error_reporting(E_ALL & ~E_NOTICE);

at the end of my site/config.php file, but nothing changes.

If you're still seeing notices after doing this then the error reporting setting has not been changed successfully. You can use phpinfo() to confirm.

Depending on how PHP is set up on your server you may need to use a php.ini file or .htaccess to change settings. Or if this is a cPanel hosting you can usually change error_reporting there. Your host can advise what you need to do to change PHP settings.

Link to comment
Share on other sites

You have to decode the error_reporting number to get a human-readable result. 32767 decodes to:

E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_STRICT | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED | E_ALL

This is what I use for decoding:

<?php
// Usage: put the error reporting number in the query string like...
// decode_error.php?number=22519
$error_number = $_GET["number"];
$error_description = array( );
$error_codes = array(
    E_ERROR              => "E_ERROR",
    E_WARNING            => "E_WARNING",
    E_PARSE              => "E_PARSE",
    E_NOTICE             => "E_NOTICE",
    E_CORE_ERROR         => "E_CORE_ERROR",
    E_CORE_WARNING       => "E_CORE_WARNING",
    E_COMPILE_ERROR      => "E_COMPILE_ERROR",
    E_COMPILE_WARNING    => "E_COMPILE_WARNING",
    E_USER_ERROR         => "E_USER_ERROR",
    E_USER_WARNING       => "E_USER_WARNING",
    E_USER_NOTICE        => "E_USER_NOTICE",
    E_STRICT             => "E_STRICT",
    E_RECOVERABLE_ERROR  => "E_RECOVERABLE_ERROR",
    E_DEPRECATED         => "E_DEPRECATED",
    E_USER_DEPRECATED    => "E_USER_DEPRECATED",
    E_ALL                => "E_ALL"
);
foreach( $error_codes as $number => $description )
{
    if ( ( $number & $error_number ) == $number )
    {
        $error_description[ ] = $description;
    }
}
echo sprintf(
    "error number %d corresponds to:\n%s",
    $error_number,
    implode( " | ", $error_description )
);

You want to set error_reporting so E_NOTICE is off (~ means not):

E_ALL & ~E_NOTICE

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...