Yax Yax - 11 months ago 48
PHP Question

PHP files open blank on my website on a linux system

I just finished working on a site. Everything is working fine on the local server but the page won't open if I use

on a live server.
does work on the live server but all the PHP code enclosed in
<?php ?>
are displayed as-is instead of running.

My site is hosted at Linux Hosting with cPanel and I have uploaded my files via FileZilla to the web root (public_html/www) folder.

Connection to the database is


HTML and embeded PHP goes here...

This works fine on WAMP.

Answer Source

Aha! Try this instead:

require_once 'Conn/connection.php';

The backslash is invalid on Linux systems, but will work fine on Windows. Switching to the forward slash should work on both. My guess is that your program is exiting early with a fatal error, and if you check your web server logs, you'll see the problem.

Also, since require_once is a keyword, I tend to use it without brackets, even though brackets will work. There are circumstances in which calling it in a function context is necessary, but this isn't one of them.