Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2012, 09:06 AM   PM User | #1
wonderwall
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
wonderwall is an unknown quantity at this point
My first PHP

Hello everyone,

last couple of days i have started learning PHP and made my first code.
Following in the coding

<html>
<head>
<title>My first PHP script </title>
</head>
<body>

<?php
//This scrip will print a line on page
echo"Hello world this is my first php script";
?>
</body>
</html>


and when i debug it i get the error

syntax error, unexpected '!' in D:\xampp\php\php.exe on line 1

Please help me
wonderwall is offline   Reply With Quote
Old 11-20-2012, 10:39 AM   PM User | #2
minder
Banned

 
Join Date: Oct 2012
Posts: 81
Thanks: 0
Thanked 4 Times in 4 Posts
minder can only hope to improve
Quote:
Originally Posted by wonderwall View Post
and when i debug it i get the error

syntax error, unexpected '!' in D:\xampp\php\php.exe on line 1

Please help me
in php.exe???

The file your code is in should have a .php extension in the name. It works fine when copied to index.php on my xampp server.
minder is offline   Reply With Quote
Users who have thanked minder for this post:
wonderwall (11-23-2012)
Old 11-20-2012, 02:18 PM   PM User | #3
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 860
Thanks: 68
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
Yup just make sure it has a .php extension and it should work.

Also if you are learning make sure to visit http://php.net.

to note, if you're just starting out take a look at some of the String and Array functions and maybe play about with them. I am learning PHP and I always just create random stuff and play about with the functions to see what the result is. Due to doing this I have managed to implement certain codes to my actual site. I find it really cool to use the return value of one function as a parameter for another function.

Kind regards,

LC.
__________________
Carewizard - http://www.carewizard.co.uk

Last edited by LearningCoder; 11-20-2012 at 02:20 PM..
LearningCoder is offline   Reply With Quote
Users who have thanked LearningCoder for this post:
wonderwall (11-23-2012)
Old 11-23-2012, 06:15 AM   PM User | #4
wonderwall
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
wonderwall is an unknown quantity at this point
Thanks for your replies.

Actually the file name is first.php, what mentioned "php.exe" in the error is something else. Any other suggestion would be appreciated.
wonderwall is offline   Reply With Quote
Old 11-24-2012, 12:19 AM   PM User | #5
Mooseman
Regular Coder

 
Mooseman's Avatar
 
Join Date: Sep 2010
Posts: 118
Thanks: 7
Thanked 3 Times in 3 Posts
Mooseman is an unknown quantity at this point
Quote:
Originally Posted by wonderwall View Post
Actually the file name is first.php, what mentioned "php.exe" in the error is something else.
Run the PHP code on a server. Your local PHP configuration is incorrect, and is accessing the D:/ drive, which I would assume is a disc drive.
Mooseman is offline   Reply With Quote
Old 11-24-2012, 09:58 AM   PM User | #6
wonderwall
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
wonderwall is an unknown quantity at this point
hello,

I was using XAMPP to host a local server on my D drive. Is it enough?
wonderwall is offline   Reply With Quote
Old 11-24-2012, 11:45 AM   PM User | #7
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
The file at "D:\xampp\php\php.exe" must be related to your PHP configuration. Check the syntax on line 1 in that file.
Custard7A is offline   Reply With Quote
Old 11-24-2012, 10:28 PM   PM User | #8
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by wonderwall View Post
hello,

I was using XAMPP to host a local server on my D drive. Is it enough?
Yeah, you can run XAMPP from any drive. You are running the first.php file in the browser, correct? Usually you browse your XAMPP site by going to http://localhost/ but you can set to to another host in your httpd.conf if you have it added to your hosts file as well. Also, if you can't get XAMPP working properly you can try WAMPServer instead, which is essentially the same thing.
Inigoesdr is offline   Reply With Quote
Old 11-25-2012, 03:23 PM   PM User | #9
wonderwall
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
wonderwall is an unknown quantity at this point
XAMPP is working fine and i am able to see the result of my program when i open the link "http://localhost/first.php". no error in the browser when i ran the program. btw the error is coming when i debug the program in php designer8.
wonderwall is offline   Reply With Quote
Old 11-26-2012, 04:42 AM   PM User | #10
wonderwall
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
wonderwall is an unknown quantity at this point
Actually i am debugging the script in php designer8 evaluation version. the output comes fine when i open the scrip in the browser after running the script but first it gives me the above error. btw i removed the evaluation version and installed a complete version and i dont get the error anymore i dont think it was related to php designer?
wonderwall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:53 AM.


Advertisement
Log in to turn off these ads.