New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Enabling PHP


Post Reply New Thread Subscribe

 
Thread Tools
InkL0sed

 
Member Since: Mar 10, 2009
Posts: 5
InkL0sed is on a distinguished road

InkL0sed is offline
I can't seem to get php to work.

I was following a tutorial for php when I opened this file in my browser (called index.php):

Code:
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo "<p>Hello World!</p>"; ?> 
 </body>
</html>
It either displays all of the text in the file, or:
Code:
Hello World!
; ?>
I googled mac tutorials for php, and found that it needed to be enabled, so I followed the instructions, took out the comment in the /private/etc/apache2/httpd.conf file, but it still doesn't seem to work.

So basically I'm lost.

What am I doing wrong? I'm sure it's something really simple...
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,050
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Simple instructions:
1. Turn on Web Sharing in System Preferences
2. Open /Applications/Utilities/Terminal.app
3. Execute the following in the Terminal: sudo nano /private/etc/apache2/httpd.conf
4. Scroll down to the following line: LoadModule php5_module libexec/apache2/libphp5.so (second last LoadModule line for me)
5. Uncomment it by removing the # at the beginning
6. Save that by pushing CTRL-O and then exit by pushing CTRL-X
7. Type the follwing command: sudo apachectl restart
8. Enjoy php

Let me know if you encounter any problems.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
InkL0sed

 
Member Since: Mar 10, 2009
Posts: 5
InkL0sed is on a distinguished road

InkL0sed is offline
I did all of that except the "sudo apachectl restart" part - could that really be the only problem?
QUOTE Thanks
InkL0sed

 
Member Since: Mar 10, 2009
Posts: 5
InkL0sed is on a distinguished road

InkL0sed is offline
It seems to be working. All I had to do was run sudo apachectl restart.

Thanks a lot!
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,050
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Quote:
Originally Posted by InkL0sed View Post
I did all of that except the "sudo apachectl restart" part - could that really be the only problem?
In case you're still wondering, yes that's the culprit. If you make changes to apache's config file (and many other programs), you have to restart them for the changes to take effect.

Best of luck with PHP!

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks

Post Reply New Thread Subscribe


« username password prompt - do not want | What URL do I use to link to my facebook page? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
php won't send to email? reholmes OS X - Development and Darwin 0 07-16-2007 04:13 AM
PHP email form won't work reholmes OS X - Operating System 0 07-15-2007 03:39 PM
Setting up PHP and PHP Nuke EvoMac Web Design and Hosting 2 02-18-2005 12:38 PM
Enabling PHP JGarcia Web Design and Hosting 3 03-05-2004 09:35 PM
Enabling PHP in Mac OS 10.2 dmonk OS X - Development and Darwin 4 01-11-2004 09:20 AM

All times are GMT -4. The time now is 12:24 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?