Jump to content

Php File Encoding


23.12.2012
 Share

Recommended Posts

Well... it's a little bit more complicated. I've got the following source:

<?phpsession_start();include_once('functions/includes.php');?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">	<head>		<title>Name -- <?php echo user_title(trim($_GET['id'])); ?></title>	</head>	<body>	<?phpif(!isset($_SESSION['id'])) {	is_logged();}else {	echo "Name: $_GET['name']";	echo "<br />Code: $_GET['code']";	echo "<br />Membership: ";	echo "<br />Phone: $_GET['phone']";	echo "<br />Email: $_GET['email']";	echo "<br />Address: $_GET['address']";	echo "<br />Others: $_GET['others']";}?>		</body></html>

And here's the HTML source it produces:

<?phpsession_start();include_once('functions/includes.php');?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">	<head>		<title>Name -- <?php echo user_title(trim($_GET['id'])); ?></title>	</head>	<body>	<?phpif(!isset($_SESSION['id'])) {	is_logged();}else {	echo "Name: $_GET['name']";	echo "<br />Code: $_GET['code']";	echo "<br />Membership: ";	echo "<br />Phone: $_GET['phone']";	echo "<br />Email: $_GET['email']";	echo "<br />Address: $_GET['address']";	echo "<br />Others: $_GET['others']";}?>		</body></html>

So basically, the PHP does not get interpreted. I know it's an encoding error, generated by the application the script was written in, and not the script itself, because it does not happen across the local server, so all the other pages work like a charm. I'm currently using UTF-16, and here's the source highlighted by Firefox. http://files.droplr.com/files/66961381/hFo....43.52%20AM.pngI adjusted the sources to English, but I'm sure this is not the problem, as I've used no local characters, only Latin and 0-9

Edited by 23.12.2012
Link to comment
Share on other sites

PHP is installed on the server, so whatever server you have, it needs to be configured to execute PHP files.It may work on your local server, because you have configured it. If you haven't configured the other one, it may not work. Make sure your host has configured PHP on their servers, or ask them if they don't say it.

Link to comment
Share on other sites

I've never said anything about another server. It's the same folder, the same machine, same Apache & PHP configuration. I tried TextEdit and the result was not different. I'll give vim a try.

Edited by 23.12.2012
Link to comment
Share on other sites

Well... not 100% sure, but what else could it be? The PHP interpreter works for all the other files around the computer, and I can't see what I am doing wrong. I'll try rewriting it, just in case. Vim didn't work either...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...