...

View Full Version : My first PHP



wonderwall
11-20-2012, 10:06 AM
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

minder
11-20-2012, 11:39 AM
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.

LearningCoder
11-20-2012, 03:18 PM
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 (http://php.net/manual/en/ref.strings.php) and Array (http://php.net/manual/en/ref.array.php) 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.

wonderwall
11-23-2012, 07:15 AM
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.

Mooseman
11-24-2012, 01:19 AM
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.

wonderwall
11-24-2012, 10:58 AM
hello,

I was using XAMPP to host a local server on my D drive. Is it enough?

Custard7A
11-24-2012, 12:45 PM
The file at "D:\xampp\php\php.exe" must be related to your PHP configuration. Check the syntax on line 1 in that file.

Inigoesdr
11-24-2012, 11:28 PM
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 (http://www.wampserver.com/en/) instead, which is essentially the same thing.

wonderwall
11-25-2012, 04:23 PM
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
11-26-2012, 05:42 AM
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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum