Results 1 to 5 of 5
  1. #1

    Member Since
    Feb 06, 2011
    Anyone help me figure out why php won't run even though I'm using MAMP
    First off I am new to the web design/programming world and this will probably be akin to someone posting to an automotive forum "How do I put a spare tire on?"

    So I'm trying to get PHP up and running on my MBP. I am new to programming like I said, however I'm not bad at getting into dreamweaver and making changes to get things how I want to look and can get files saved from there opened via Safari/Firefox just fine. Now I'm trying to run a very basic php script (going through a php for absolute beginners page to start to learn it) just so I can check to make sure systems are all running. I've installed MAMP and it turns on fine and shows as everything working there. However when I open up the script I saved (PHPtest1.php) all the code appears along with text rather then the clean text. I'm not sure if I'm leaving out any info you might need but any and all help would be appreciated as I've just lost a ton of time to figuring out something that by all accounts should be quick and painless. I do have "websharing" turned on in my preferencs.

    Here is the script that I try to open (and consequently appears in the broswer exactly this way) :


    Agent: So who do you think you are, anyhow?
    <br />

    // print output
    echo 'Neo: I am Neo, but my people call me The One.';


  2. #2

    wheelguy's Avatar
    Member Since
    Jun 18, 2006
    MacBook Pro
    You have the text marked out with the // and you only need the print or echo command
    <?php print "Neo: I am Neo, but my people call me The One."; ?>

    Here is a good place to start PHP Tutorial
    If you aren't fired with enthusiasm, you will be fired with enthusiasm. -Vince Lombardi

  3. #3

    Member Since
    Apr 07, 2008
    Coeur d' Alene, Idaho
    Macbook Pro, iMac
    I had a jolly time getting php working. It wasn't hard, just needed a few defaults in the php.ini file changed... especially the option for "short_tags".

    In /etc/php.ini, under Language Options, change

    short_open_tag = Off


    short_open_tag = On

    Once I did this, my php files worked.

    Also, the first file I would use to verify php is one like this that I made: I make a file called phpinfo.php. In this file I typed:


    If php is working, you will get a printout of all php's configuration. VERY helpful to diagnose problems.

    Hope this helps.


  4. #4

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    2012 13" MBP (2.5 i5, 8GB)
    I am by no means a PHP expert but I believe the issue has something to do with the permissions on the page. Try the following:

    1. Open up Terminal (/Applications/Utilities) and type the following:
    chmod 644
    2. Now, drag the php file from Finder onto the Terminal window. The line in the terminal should now something like the following:
    chmod 644 /path/to/phpfile/file.php
    Press enter. Reload the page.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5

    Member Since
    Feb 06, 2011
    Before I try fooling with anything in terminal I just wanted to give everyone an update. I tried saving the .php files to sites in "User" on the HD and voila php scripts run beautifully from there. Not sure if this would pinpoint why when saved to MAMP (Applications> Mamp> phpscript.php) php won't run.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Making an interface to run a php file in Terminal
    By juniorj23 in forum iOS and Apps
    Replies: 2
    Last Post: 06-09-2012, 02:42 PM
  2. MAMP won't accept my mySQL username and password
    By timetostopmac in forum Web Design and Hosting
    Replies: 1
    Last Post: 09-30-2010, 07:07 AM
  3. how to write php files with MAMP ?
    By Eisa in forum Web Design and Hosting
    Replies: 3
    Last Post: 05-18-2008, 11:32 AM
  4. I can't figure out why bootcamp won't partition.
    By Steveoknox24 in forum Running Windows (or anything else) on your Mac
    Replies: 2
    Last Post: 08-03-2007, 12:48 AM
  5. MAMP: PHP can't catch HTTP variables
    By komo in forum Web Design and Hosting
    Replies: 4
    Last Post: 06-05-2006, 10:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts