Title: Parse Error: Syntax Error when index.php copied to root
Last modified: August 21, 2016

---

# Parse Error: Syntax Error when index.php copied to root

 *  Resolved [SomethingWonderful](https://wordpress.org/support/users/somethingwonderful/)
 * (@somethingwonderful)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/)
 * I’m having a nightmare.
 * When I copy the index.php file (and the htaccess) to the root directory I’m getting
   the error message below?
 * “”Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in /home/*****/
   public_html/index.php on line 17″”
 * I’ve created many wordpress sites and never come across this problem before. 
   It’s happening on every new install.
 * No plug-ins, no custom themes, happens on the cleanest new installation. My hosting
   company also have no idea what could be causing the problem.
 * Has anyone else had this problem, or can anyone enlighten me with suggestions?
 * Many thanks,
 * SW

Viewing 12 replies - 16 through 27 (of 27 total)

[←](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/?output_format=md)
[1](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/?output_format=md)
2

 *  [precisioncomputing](https://wordpress.org/support/users/precisioncomputing/)
 * (@precisioncomputing)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343293)
 * Hello,
    Through trial and error I changed line 17 of my index.php to be the following
   and I got the result that I was looking for.
 * require(‘. wp/wp-blog-header.php’);
 * * ‘wp’ is the directory I have the WordPress installation in
 * I can not believe that WordPress has not made this an easy scripted change. I
   think that this is going to be a very common request.
 * Please make this just a little easier to make everyones life stress free.
 * I am keen to know if this helps anyone else.
 *  [kingofwingshair](https://wordpress.org/support/users/kingofwingshair/)
 * (@kingofwingshair)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343298)
 * I am having the same issue with the parse error.
 * What did your index.php file look like when you got it to work?
 * I’ll try copying and pasting it into mine. Thanks!
 *  [naomispirit](https://wordpress.org/support/users/naomispirit/)
 * (@naomispirit)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343299)
 * Hi, I’ve got the same issue but that same change didn’t work for me. Anyone else
   resolve this in any other way? Cheers
    Naomi
 *  [nicocluster](https://wordpress.org/support/users/nicocluster/)
 * (@nicocluster)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343301)
 * I RESOLVED it in this way:
    in the index.php in the root i changed this:
 * require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );
 * into this:
 * require( dirname( __FILE__ ) . ‘/wpfolder/wp-blog-header.php’ );
 * using text editor on mac BUT WITHOUT WRITING!
    i copied-pasted the letters that
   i needed from other words from the same file.
 * It worked for me!
    So i think this was a font error!
 *  Thread Starter [SomethingWonderful](https://wordpress.org/support/users/somethingwonderful/)
 * (@somethingwonderful)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343302)
 * I RESOLVED this issue by using the file editor within cPanel and Extend on my
   two hosting accounts.
 * Whenever I tried to edit the code in text editor on my iMac or within Dreamweaver
   I would get the errors mentioned above. It was driving me mad..!!!!
 * As nicocluster says I think it’s an issue with text editor for mac.
 *  [renewmarketingltd](https://wordpress.org/support/users/renewmarketingltd/)
 * (@renewmarketingltd)
 * [12 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343308)
 * **I just did the same as above, it was driving me nuts too.**
    Change it in the
   file editor on your cPanel and it works first time. I’m also using a Mac which
   seems to be part of the problem from what others have said above.
 *  [cptsplading](https://wordpress.org/support/users/cptsplading/)
 * (@cptsplading)
 * [12 years ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343311)
 * I ran into the same issue. After a lot of trial and error, I ran across this 
   thread and discovered the problem is the way that Text Editor on the Mac handles
   single quotes. If you look carefully, it’s a slightly different symbol.
 * I was able to get things to work by copying the single quote at the end of the
   `
   require( dirname( __FILE__ ) . '/wpfolder/wp-blog-header.php' );` line and then
   pasting that single quote at the beginning of the path. Everything worked then.
 *  [sannahkhan](https://wordpress.org/support/users/sannahkhan/)
 * (@sannahkhan)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343317)
 * Oh my god. I find this completely ridiculous. I was struggling with this as well,
   and finally came across this thread. My solution was like those above – just 
   to use the cpanel editor to achieve the same results, rather than TextEdit on
   my Mac.
 * So frustrating!
 *  [Jaywill77](https://wordpress.org/support/users/jaywill77/)
 * (@jaywill77)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343318)
 * It’s crazy!!!! Been on this for more than an hour pulling my hair out (especially
   knowing the code was supposed to be correct!). Editing from CPanel did the trick
   eventually! Thanks a lot y’all!
    Apple is sliding more and more. I guess I need
   to find a basic text editor to replace the one I have. Don’t wanna lose time 
   every time I go into editing.
 *  [jamielucas](https://wordpress.org/support/users/jamielucas/)
 * (@jamielucas)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343319)
 * I just wanted to say THANKS A MILLION!!! I’m such a newbie to wordpress, and 
   this saved me from pulling my own hair out!!! I was using textedit as well, and
   then luckily found this thread on google. Again, THANKS A TON!!!
 *  [sunnydeora](https://wordpress.org/support/users/sunnydeora/)
 * (@sunnydeora)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343320)
 * I am still facing this problem please advise me how to handel this . i tried 
   require( dirname( __FILE__ ) . ‘/wpfolder/wp-blog-header.php’ ); same copy and
   paste on my index.php file. still showing me error .
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 7 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343321)
 * > I RESOLVED this issue by using the file editor within cPanel and Extend on 
   > my two hosting accounts.
   > Whenever I tried to edit the code in text editor on my iMac or within Dreamweaver
   > I would get the errors mentioned above. It was driving me mad..!!!!
 * [https://wordpress.org/support/forum/how-to-and-troubleshooting#postform](https://wordpress.org/support/forum/how-to-and-troubleshooting#postform)

Viewing 12 replies - 16 through 27 (of 27 total)

[←](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/?output_format=md)
[1](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/?output_format=md)
2

The topic ‘Parse Error: Syntax Error when index.php copied to root’ is closed to
new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 27 replies
 * 14 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/parse-error-syntax-error-when-indexphp-copied-to-root/page/2/#post-4343321)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
