Working on Remote server - Error
Working on Remote server - Error
edanyildiz
Posts: 43Questions: 13Answers: 4
Hi, i upload my script to PHP (v 5.3.29) server;
I get Ajax errors - 500 (Internal Server Error) ;
So i figured out the issue;
when i write like this everything is fine, there is no problem;
//if edit mode and password is blank, do not save.
$editor->on( 'preEdit', function ( $e, $id, $values ) {
if ( $values['users']['user_pass'] === '' ) {
$e->field( 'users.user_pass' )->set( false );
}
} );
//if create - validate for pass
$editor->on( 'preCreate', function ( $editor, $values ) {
$editor->field( 'users.user_pass' );
$editor->validator( 'Validate::notEmpty' );
} );
but in my original script in localhost, the code is like below;
//if edit mode and password is blank, do not save.
->on( 'preEdit', function ( $e, $id, $values ) {
if ( $values['users']['user_pass'] === '' ) {
$e->field( 'users.user_pass' )->set( false );
}
} )
//if create - validate for pass
->on( 'preCreate', function ( $editor, $values ) {
$editor
->field( 'users.user_pass' )
->validator( 'Validate::notEmpty' );
} );
so is there a way to make the original code work on remote server without any changes? Cause i have to update so many rows.
Thanx
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Does the server's error log show any information that explains what the issue is? I don't immediately see what the error would be in the above.
Thanks,
Allan
Sorry Allan, i really don't know how to find server's error log.
this is the error i get.
I can modify the scripts but i couldn't manage to make work one row,
Here is the code working on local server;
I realised that when i remove the below row, it works perfect.
->allowedExtensions( [ 'png', 'jpg', 'gif' ], "Please upload an image" )
Do you have any suggestions ? How can i modify this row?
changing this,
//->allowedExtensions( [ 'png', 'jpg', 'gif' ], "Please upload an image" )
to this,
->allowedExtensions( array( 'png', 'jpg', 'gif' ), "Please upload an image" )
solved the problems.
I think it is something about the server.
Thanx.
Ah!!
[]
is PHP 5.4 array syntax. 5.3 requiresarray()
syntax.The doc comments in the Upload.php file appear to use the 5.4 style, which I'll change for the next release. Is that where you found the example code for this, or was it somewhere else?
Allan
Hi Allan,
I found the example on the new examples while i was exploring editor 1.6.1.
There is one more thing,
i think this line gives an error in php 5.3 (Master/Child table example)
Any suggestions?
Thank you.
I solved the problem;
This works in PHP 5.3
echo json_encode(array("data" => ""));