1
votes

If I write a php file on /var/www/html, the php file works well. For example a simple script in which I print phpinfo().

If I write a php script on my computer, then drag it to my server using Filezilla, it uploads well - to the extent that there are no error messages, and I am able to move the php script to /var/www/html.

However, when I try to access the file through my server's ip address (i.e. [server ip]/file.php - the page displays this error:

The 45.55.136.85 page isn’t working

45.55.136.85 is currently unable to handle this request. HTTP ERROR 500

For more information:

I write the php file in gedit encoded using Current Locale UTF-8 Line Ending Unix/Linux. And I have tried the three available transfer settings with no success Auto/Binary/ASCII on Filezilla

I upload files using FTP over TLS using Filezilla.

I have installed a LAMP stack.

1
look at your apache error log to see what isn't working. although my first guess, if the files are equal (test with a checksum), would be that ftp and web run as different users so the web server may lack access privileges. please check with ls -l - Franz Gleichmann
@FranzGleichmann /var/log/apache2/error.log? Is that where I would find error logs? - user7415558
@FranzGleichmann Also would there be an access problem if the web server has higher access privileges than ftp? - user7415558
there is no such thing as "higher" access privileges.... there is (simplified) only read, write, execute, each once for owner, group and everybody. and if the file belongs to the ftp user, the web server can not execute it - Franz Gleichmann
@FranzGleichmann I used "mv" to move the file thinking that the web server would then be able to execute it. I guess I was wrong. What approach would you recommend? - user7415558

1 Answers

1
votes

This is a file permission problem, to solve this go to your Cpanel and under metrics section go into the errors

Getting into error section cpanel

Most of the time you will find such error because of assigning extra permissions(write and execute) to the Group or World.

To solve this just withdraw the file permission and follow the below permission pattern.

Mode    User    Group   World
Read    check   check   check       
Write   check   uncheck uncheck
Execute uncheck uncheck uncheck