Hack Forums
[PHP] PHP Include causing error 500 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] PHP Include causing error 500 (/showthread.php?tid=5834729)



PHP Include causing error 500 - Honeybun - May 9, 2018

I'm a total noob to php, still learning.

trying to include air2.php in my index, they're all located in the same dir.

Code
<html>
<?php

This is a test script for the On-Air System.

include 'air2.php'
?>
</html>

Whenever I load air2.php manually, it loads just fine.


RE: PHP Include causing error 500 - ThomasGB - May 9, 2018

Code
<html>

This is a test script for the On-Air System.

<?php include 'air2.php'; ?>
</html>
 
this should work for you


RE: PHP Include causing error 500 - Honeybun - May 9, 2018

(May 9, 2018 02:18 PM)ThomasGB Wrote:  
Code
<html>

This is a test script for the On-Air System.

<?php include 'air2.php'; ?>
</html>
 
this should work for you

You're a real fucking G.


RE: PHP Include causing error 500 - Anxuein - May 9, 2018

Just some clarification, you added "This is a test script for the On-Air System." in the PHP code. This is not valid PHP code. It looks like it is meant to be outside, judging by later responses, but if you do want to do comments in PHP, you just add // before.
PHP Code

<?php 
// This is a comment 



RE: PHP Include causing error 500 - Nachfolger - May 9, 2018

You didn't include a semi-colon after the include statement. PHP REQUIRES a statement end bracket, unlike javascript.

Code
include('page.php');



RE: PHP Include causing error 500 - Honeybun - May 10, 2018

(May 9, 2018 03:46 PM)Anxuein Wrote:  Just some clarification, you added "This is a test script for the On-Air System." in the PHP code. This is not valid PHP code. It looks like it is meant to be outside, judging by later responses, but if you do want to do comments in PHP, you just add // before.
PHP Code

<?php 
// This is a comment 

I honestly have no idea how I missed this, lol.


(May 9, 2018 04:33 PM)Nachfolger Wrote:  You didn't include a semi-colon after the include statement. PHP REQUIRES a statement end bracket, unlike javascript.

Code
include('page.php');

Gotcha'. Got this working - sorta. Thanks everyone for their help.