Hosting Knowledge Base
Parse error: syntax error, unexpected T_STRING
In this tutorial, we’re going to provide details regarding the error message syntax error, unexpected T_STRING, including meaning and ways to fix it.
What Does the Error Mean?
The error message Parse error: syntax error, unexpected T_STRING usually appears when an .html file starts with an
<? tag. This confuses our Apache web server when attempting to execute the code as it is a PHP script.
How Can I Overcome this Problem?
This issue can be easily resolved in five easy steps:
- Log into your AwardSpace hosting account through our portal.
- Visit the PHP Settings section.
- Click on the here button.
- Locate the line
short_open_tag = Onand change it to
short_open_tag = Off.
- Press Save to save the changes you have just made.
What If I Do Not Have Access to the PHP.ini File? Am I Still Able to Fix the Error?
If, for some reason, you’re unable to access the PHP.ini section or your account type does not give you enough rights to modify the PHP.ini file, you can still resolve the error with the use of a text file, called .htaccess.
The steps you need to perform are the following:
- Sign in to your Hosting Control Panel.
- Navigate to the File Manager section.
- Create a .htaccess file in your domain directory with the below code:
RemoveHandler .html .htm
The screenshot below illustrates how your code should look like:
After you follow the above steps, clear your browser’s cache, and then reload your HTML page. No further parse errors will appear when visiting your website in a browser.