I am getting a 500 Internal Server Error after I restored my public html folder

Hey guys, I had to restore my website back to yesterdays backup file and when it completed, I got a 500 Internal Server Error with this error code in the log…PHP Warning: Unexpected character in input: ‘’ (ASCII=92) state=1 in /home3/boardtr1/public_html/index.php on line 21
[16-Dec-2014 10:44:31] PHP Parse error: syntax error, unexpected T_STRING in /home3/boardtr1/public_html/index.php on line 21…I am on Bluehost and running PHP Version 5.4.24. I looked all over but could not find any solutions. Any help would be great since my site is down -_-

Thanks!
Nick

Show us lines 1-23 of index.php?

Here are lines 1-25

<?php
/**
 *
 *    iLister v.7.0.0, (c) WorksForWeb 2005 - 2014
 *
 *    Package: iLister-7.0.0
 *    Tag: modular/projects/classifieds/tags/7.0.0@16415, 2014-10-03 12:13:35
 *
 *    This file is a part of iLister software
 *    and is protected by international copyright laws
 *
 */

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

define("PATH_TO_ROOT", "./");

require_once "core/WebApplication.php";

$app = new \\core\WebApplication(
    PATH_TO_ROOT . "apps/FrontEnd/config/default.ini",
    PATH_TO_ROOT . "apps/FrontEnd/config/local.ini"
);
$app->run();

You seem to have a double backslash on that line:

$app = new \\core\WebApplication(

Just change it into \code and it should work.

I went ahead and deleted that extra \ but nothing changed. Anything I should be looking for? This hasnt happened to me before.

Is the same error produced? The syntax is valid and should at least change the error you get.

This is what the error log is giving me

[16-Dec-2014 12:10:01] PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in /home3/boardtr1/public_html/index.php on line 21
[16-Dec-2014 12:10:01] PHP Parse error:  syntax error, unexpected T_STRING in /home3/boardtr1/public_html/index.php on line 21

could it be something in my htaccess file? This is it below

# Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php54s .php
RewriteEngine On

RewriteCond %{HTTP_HOST} ^boardtrader.com [NC]
RewriteRule (.*) http://www.boardtrader.com/$1 [L,R=301]

#without www
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#with www
##RewriteCond %{HTTP_HOST} ^(?!www\.)(.+)
##RewriteRule ^(.*) http://www.%1/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php

<Files *.ini>
    order deny,allow
    deny from all
</Files>
 
    
# Start CloudFlare:boardtrader.com rewrite. Do not Edit 
RewriteEngine On 
#RewriteCond %{HTTP_HOST} ^boardtrader.com 
##RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 
# End CloudFlare rewrite. 

#IpBlocklistManager_Start

#IpBlocklistManager_EndOptions -Indexes

Ah, then it’s extremely likely you have some invisible unicode characters left in your code from whatever copying procedure you did.

To clean them, copy the contents of the index.php file into a simple text editor like Sublime Text or even Notepad, and then select all, copy back into index.php, overwriting what was there before. That should do it.

Also, to avoid these types of problems in the future, please try and make sure your source code files are saved in UTF8 (using a decent code editor usually takes care of that for you, as well as any “invisible character” issues).

1 Like

Great…I am going to give that a try. I use Notepad ++ but I guess I did something I shouldnt have.

I am still getting the name error message. I double checked it and even downloaded Sublime! Any other files I should try?

It’s really hard to say without looking at all the code, but you definitely should be getting a different error now, if any at all.

Still the same error…it just repeats over and over again in the error_log. I even tried restoring the site back to a couple days ago and it wont budge. I have no clue what it could be. And the reason I restored the public html directory was to clear listings that I was testing in a new Category. It wasnt anything major or code related.

I dont know if this helps but I tried restoring my Home Directory and I got this huge error…

Restore failed. The following folders are not writable by the user:

/home3/boardtr1/BackupNow/.system

at (eval 16) line 34. at /usr/share/perl5/Carp/Heavy.pm line 59 Carp::shortmess_real('Restore failed. The following folders are not writable by th...') called at /usr/share/perl5/Carp.pm line 44 Carp::croak('Restore failed. The following folders are not writable by th...') called at /var/www/lib/Server/WHM.pm line 634 Server::WHM::whm_perl_code(undef, undef, undef) called at /var/www/lib/BM.pm line 50 BM::run_whm_code('BM=HASH(0x7f70f88f7a68)', 'HASH(0x7f70f97066f8)', '\x{a} my $status_dir = $_->{\'status_dir\'} or die \'nee...') called at /var/www/lib/BM.pm line 821 BM::whm_restore_file('BM=HASH(0x7f70f88f7a68)', 'HASH(0x7f70f97066f8)') called at /var/www/cgi/bm line 1021 ModPerl::ROOT::Handler::Registry::var_www_cgi_bm::begin_restore('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...') called at /var/www/cgi/bm line 410 eval {...} called at /var/www/cgi/bm line 385 ModPerl::ROOT::Handler::Registry::var_www_cgi_bm::run_ajax_pre_step('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...', 'run_ajax') called at /var/www/lib/App.pm line 166 App::run_hook('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...', 'pre_step', 'run_ajax') called at /usr/share/perl5/vendor_perl/CGI/Ex/App.pm line 183 CGI::Ex::App::run_step('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...', 'run_ajax') called at /var/www/lib/App.pm line 166 App::run_hook('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...', 'run_step', 'run_ajax') called at /usr/share/perl5/vendor_perl/CGI/Ex/App.pm line 88 CGI::Ex::App::nav_loop('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...') called at /var/www/lib/App.pm line 193 App::nav_loop('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm=HASH(0x7f70f...') called at /usr/share/perl5/vendor_perl/CGI/Ex/App.pm line 48 eval {...} called at /usr/share/perl5/vendor_perl/CGI/Ex/App.pm line 45 CGI::Ex::App::navigate('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm') called at /var/www/lib/App.pm line 126 eval {...} called at /var/www/lib/App.pm line 123 App::navigate('ModPerl::ROOT::Handler::Registry::var_www_cgi_bm') called at /var/www/cgi/bm line 24 ModPerl::ROOT::Handler::Registry::var_www_cgi_bm::handler('Apache2::RequestRec=SCALAR(0x7f70f96ff8f0)') called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204 eval {...} called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204 ModPerl::RegistryCooker::run('Handler::Registry=HASH(0x7f70f972b940)') called at /var/www/lib/Handler/Registry.pm line 37 Handler::Registry::run('Handler::Registry=HASH(0x7f70f972b940)') called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 170 ModPerl::RegistryCooker::default_handler('Handler::Registry=HASH(0x7f70f972b940)') called at /var/www/lib/Handler/Registry.pm line 65 Handler::Registry::default_handler('Handler::Registry=HASH(0x7f70f972b940)') called at /usr/lib64/perl5/vendor_perl/ModPerl/Registry.pm line 31 ModPerl::Registry::handler('Handler::Registry', 'Apache2::RequestRec=SCALAR(0x7f70f96ff8f0)') called at -e line 0 eval {...} called at -e line 0

Well, did you make the folders writable by the user which runs the PHP process?

yeah, I checked and they are set at 755…i do have .tpl files set at 644 but I was told thats what it should be

I’m at a loss, but to be frank, your entire restore/testing/deployment procedure seems strange. Why not use Git for version control and restorations and be rid of all these difficulties?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.