fixed php and nginx errors. Finally working scripts