leranjun Posted June 8, 2019 Posted June 8, 2019 Hi,When I tried to open a PHP file in a subdirectory of my main website, the website encountered a 500 error (screenshot attached below).Is PHP not supported in subdirectories? 1
Flaze Posted June 8, 2019 Posted June 8, 2019 Did you set permission to 644 for files and 755 for folders?
leranjun Posted June 8, 2019 Author Posted June 8, 2019 Yes, everything is 755.I can view the image file and the html file, but not PHP.
Flaze Posted June 8, 2019 Posted June 8, 2019 Not everything. Only folders need to have 755 permission. Files should be set to 644.
Sn1F3rt Posted June 8, 2019 Posted June 8, 2019 Not everything. Only folders need to have 755 permission. Files should be set to 644.I was too thinking about that.
leranjun Posted June 8, 2019 Author Posted June 8, 2019 Sorry for the confusion… The folder is 755, and the files are 644.
Flaze Posted June 8, 2019 Posted June 8, 2019 Do you have .htaccess file inside the subdirectory? If so, try renaming them.
leranjun Posted June 8, 2019 Author Posted June 8, 2019 No, there is only .htaccess file in the main folder, not the subdirectory.
Flaze Posted June 8, 2019 Posted June 8, 2019 Try renaming that file. If that doesn't work, I'm escalating this.
leranjun Posted June 8, 2019 Author Posted June 8, 2019 The thing is, there was no .htaccess by default in the main directory. I just created it for SSL certificate.This problem was there even before I create that file.
leranjun Posted June 8, 2019 Author Posted June 8, 2019 Wait… I think it is not a PHP problem…So basically, in my subdirectory "beta" I tried to connect to a MySQL database using mysqli, and it showed me the 500 error.Now I copied the files from the subdirectory to the main folder, it showed me the error when I tried to visit the main page.I think there's something wrong with handling SQL.
Byron Posted June 8, 2019 Posted June 8, 2019 It's working now. You had folder permissions 775 instead of 755.
Recommended Posts