Parse Error For Double Quotes in PHP5 and Apache 2.2 on Windows 7
Posted on 2011-09-14
I have installed Apache 2.2.20 and PHP 5.3.8 on a Windows 7 system. I have an include file which has lines like the following :
require($_PHPLIB["libdir"] . "db_mysql.inc"); /* Change this ... */
This generates a parse error:
unexpected "", expecting T_STRING or T_VARIABLE or T_NUM_STRING in ...
Note that libdir is defined above this line, as follows, and does not generaqte a parse error:
$_PHPOLIB["libdir'] = "c:\phplib";
If I rewite $_PHPLIB["libdir"] as $_PHPLIB['libdir'] in the require() statement, it fixes the error noted above, but I get a different parse error.
Rather than present each of these, the bottom line is I had to rewrite the code line as:
require($_PHPLIB[libdir'] . 'db_mysql.inc'); /* Change this ... */
to get rid of all the parse errors related to that line.
Note, I have PHP5 and Apache 2.2 installed on a Linux server as well, and the identical include file is there with all the double quotes as above. No parse errors.
Why is PHP behaving differently under Windows than it does under Linux, with respect to these double quotes inside the require() statement, but not outside of it?