ihamza — 2012-11-05T07:30:55-05:00 — #1
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.
cpradio — 2012-11-05T07:50:13-05:00 — #2
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.
ralphm — 2012-11-05T08:47:01-05:00 — #3
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.
starlion — 2012-11-05T08:59:10-05:00 — #4
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.
ihamza — 2012-11-05T10:29:25-05:00 — #5
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.
ihamza — 2012-11-05T10:35:40-05:00 — #6
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. ^_^
ihamza — 2012-11-05T10:44:12-05:00 — #7
Thanks for replying , StarLion.
I will try to figure out how to register PHP with Apache if it is not registered.
ihamza — 2012-11-06T08:50:28-05:00 — #8
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