0

Problem

I have an application that I am attempting to get online; from local dev-machine to hosting server. Albeit, my application works locally via XAMPP, running PHP v5.6, my hosting server throws up an error once it incurs (or attempts to parse) a namespace. Then, the code (on the server-side) throws this error

Parse error: syntax error, unexpected T_STRING in /home3/username/public_html/inc/controller.php on line 11

when I attempt to access the root index.php file, which reads:

index.php

# Debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

# Load Controller
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/controller.php';

# Parse Application
echo $app->output();

however, the namespace issue reside in the controller, or the 'controller.php' denoted above. Which reads:

controller.php

namespace WAFFLE\Controller;

use WAFFLE\Controller;                                  # Primary: controller for index.php
use WAFFLE\Framework\Engines\Template;                  # Template: engine developed to substitute special WAFFLE tags while publishing a clean HTML document

and line 11 would be:

namespace WAFFLE\Controller;

Both systems (local & remote) are both utilizing PHP v5.6, and "for the life of me" I can't figure out the problem here. Any assistance on this issue would surely be appreciated. Unfortunately, the helpful techs over at bluehost haven't been able to assist me on this matter, and (as mentioned) this little application does work; locally. However, once it gets uploaded to my hosting service's server, it throws the aforementioned error.

Community
  • 1
  • 1
  • 1
    Possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – ChrisGPT was on strike Apr 22 '17 at 01:34
  • I suspect you don't have all the information here - a parse error shouldn't be different from your local server and your remote server unless (*maybe*) you were using different major versions of PHP (PHP 5 vs PHP 7). Can you share what version of PHP your host is using? As well as the smallest code you can reproduce the parse error with? – HPierce Apr 22 '17 at 02:12
  • Both PHP versions (local and remote) are mentioned throughout the initial paragraph, stating that both work off of PHP v5.6. In addition, this is (literally) the code that runs through prior to these errors occuring. I can point you to the whole package on GitHub if that would help, however, I can't imagine why this operates on my system fine, when my hosting service's systems doesn't agree with it; even though they're both operating with the same version of PHP. – Justin Byrne Apr 23 '17 at 01:28
  • I'm not that affluent in how Apache works in conjunction with the ".htaccess" file, and am wondering whether this problem was brought about because of it. The reason why I mentioned this is because I overwrote the original .htaccess file with the following rewrite rules: RewriteEngine On RewriteRule ^([^/]*)\.html$ /index.php?page=$1 [L] ErrorDocument 404 http://localhost/index.php?page=404 – Justin Byrne Apr 23 '17 at 21:30

0 Answers0