I am hosting my website in Infinity. Until now, my website still works fine. From the beginning, I upload HTML5/CSS/Javascript for dry-run my front-end website and I used index.html format.
After some time coding the back-end, I decided to transform my index to index.php (Obviously also change all the data into PHP format) but when I reopen my website I got 500 error.
Does anyone have any idea about this?
Open your index.php with MonstaFTP (file manager)
and copy the source and paste here
then mark here all code with code formatting </> icon
You probably have a syntax error somewhere
and I’m a little suspicious of the file size of only 256B, unless there is really very little content inside on purpose.
As you guessed, my index.php is small as you can see because I applied the format designed by Tom Butler which I learnt in “PHP & MySQL: Novice to Ninja, 7th Edition” book.
Below is the content of my index.php
<?php
include __DIR__ . '/../includes/autoload.php';
$uri = strtok(ltrim($_SERVER['REQUEST_URI'], '/'), '?');
$MainWebsite = new \Mombaybi\MainWebsite;
$entryPoint = new \WebsiteFormat\EntryPoint($MainWebsite);
$entryPoint->run($uri, $_SERVER['REQUEST_METHOD']);
thanks Oxy for your support. I appreciate your communication.
Below is my answer to your comments.
Can you tell us briefly what you actually want to achieve?
What is the purpose of all this?
Before I was testing my front-end so I used index.html
But now I made final version of my website which includes connection to the database using MySQL so I used the format of the above-mentioned book and here comes the present
I have a feeling that maybe you could solve it with .htaccess
@Oxy I just changed configuration as you suggest to show the error of PHP. I reload the page and got this error
Warning: include(): open_basedir restriction in effect. File(/home/vol10_7/infinityfree.com/if0_34423810/htdocs/../includes/autoload.php) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol10_7/infinityfree.com/if0_34423810/htdocs) in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 2
Warning: include(/home/vol10_7/infinityfree.com/if0_34423810/htdocs/../includes/autoload.php): failed to open stream: Operation not permitted in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 2
Warning: include(): open_basedir restriction in effect. File(/home/vol10_7/infinityfree.com/if0_34423810/htdocs/../includes/autoload.php) is not within the allowed path(s): (/php_sessions:/tmp:/var/www/errors:/usr/share/pear:/home/vol10_7/infinityfree.com/if0_34423810/htdocs) in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 2
Warning: include(/home/vol10_7/infinityfree.com/if0_34423810/htdocs/../includes/autoload.php): failed to open stream: Operation not permitted in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 2
Warning: include(): Failed opening '/home/vol10_7/infinityfree.com/if0_34423810/htdocs/../includes/autoload.php' for inclusion (include_path='.:/usr/share/pear/') in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 2
Fatal error: Uncaught Error: Class 'Mombaybi\MainWebsite' not found in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php:6 Stack trace: #0 {main} thrown in /home/vol10_7/infinityfree.com/if0_34423810/htdocs/index.php on line 6
because in your code ../ comes out (up) of the htdocs folder and then the open_basedir restriction appears because all requested files (path) must be in the htdocs folder