I installed MAMP and everything is working fine but php has a problem.
I'm trying to run this script with this link( http://localhost:8888/today.php):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <br>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <br>
<title>Today’s Date</title> <br>
<meta http-equiv="content-type" <br>
content="text/html; charset=utf-8"/> <br>
<p>Today’s date (according to this web server) is <br>
echo date('l, F dS Y.'); <br>
Safari shows me an empty white page
Am I doing something wrong or did I miss something?
Please if you can help me I'd be thankful.
You have syntax errors in your PHP section (unless those BR tags were added by you later).
<!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" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
Today’s date (according to this web server) is
echo date('l, F dS Y.');
Also, did you verify Apache is running? Also, I highly recommend enabling errors to be displayed in your php.ini file (then restart apache), so you can see what errors are being sent back.
Hi iHamza. Welcome to the forums.
As cpradio's code indicates, none of those <br> tags belong in your code. Did you type them yourself, or has you code editor inserted them? If the latter, get a better code editor.
More to the point, if that is what i assume it to be (You've "Save As"'d your Source from the browser window), the problem is that PHP hasnt registered itself with your apache, so the engine doesnt get called to process the PHP tags.
Thanks for your greetings and your reply ,cpradio.
You are right, those BR shouldn't be in my PHP section and I don't know where they came from. Maybe from my browser or my text editor. ^_^
Anyway, I verified Apache is running and I will try to enable errors to be displayed and I will tell you the results soon I hope.
Thanks for greetings, ralph.m.
Actually I don't know where those BR came from I didn't type them and I don't believe my text editor did. ^_^
Thanks for replying , StarLion.
I will try to figure out how to register PHP with Apache if it is not registered.
Many thanks, cpradio.
I copied your code and it worked.
And I enabled errors to be displayed. My error was this:
Parse error: syntax error, unexpected ' ' (T_STRING) in /Applications/MAMP/htdocs/h.php on line 11
This topic is now closed. New replies are no longer allowed.