leranjun Posted June 8, 2019 Share 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 Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 Did you set permission to 644 for files and 755 for folders? Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share Posted June 8, 2019 Yes, everything is 755.I can view the image file and the html file, but not PHP. Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 Not everything. Only folders need to have 755 permission. Files should be set to 644. Link to comment Share on other sites More sharing options...
Sn1F3rt Posted June 8, 2019 Share 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. Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share Posted June 8, 2019 Sorry for the confusion… The folder is 755, and the files are 644. Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 Do you have .htaccess file inside the subdirectory? If so, try renaming them. Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share Posted June 8, 2019 No, there is only .htaccess file in the main folder, not the subdirectory. Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 Try renaming that file. If that doesn't work, I'm escalating this. Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share 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. Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 What URL were you trying to access? Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share Posted June 8, 2019 https://cistea.ga/beta Link to comment Share on other sites More sharing options...
leranjun Posted June 8, 2019 Author Share 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. Link to comment Share on other sites More sharing options...
flazepe Posted June 8, 2019 Share Posted June 8, 2019 I see. I'll let root admins figure this out. Link to comment Share on other sites More sharing options...
Byron Posted June 8, 2019 Share Posted June 8, 2019 It's working now. You had folder permissions 775 instead of 755. Link to comment Share on other sites More sharing options...
Recommended Posts