osx - PHP page comes up blank on this Mamp setup

02
2013-08
  • user823527

    I installed MAMP on this Mac OSX 10.6.6. A phpinfo test seems to say that PHP is installed. But when I open a file (e.g. index.php) in the browser, it comes up blank. What could be the problem?

  • Answers
  • Macconsultant

    Did you check file permissions on the PHP files? If the owner of the files does not have permission to execute PHP result could end up blanc.

  • Scott Wilson

    The phpinfo() command will show you where the error log is located. This should provide some clues.


  • Related Question

    What is the best Apache, PHP setup for a Mac developer?
  • Questioner

    I'm a Web Developer who has just made the switch over to Mac. Despite all that I know and love about the Windows environment I find myself in a new mysterious place.

    My question: what is the best Apache, PHP setup for a Mac developer? On Windows I've been using WAMP which was quite nice, I know Mac comes shipped with Apache 2 and PHP pre-installed. I'm just wondering if there is a better solution out there.


  • Related Answers
  • Peter M

    Snow Leopard comes with PHP 5.3 and a lot more pre-installed extensions than in Leopard - GD being the one that I always found hardest/most time-consuming to compile myself, but also PDO-mysql which is handy.

    There's also MAMP, which is a pre-configured version of PHP, Apache and Mysql, but that hasn't had its PHP version updated for quite a long time, and development generally seems really slow. Until I installed SL though, that's what I used - I turned off the built in Apache (Under "Sharing" in preferences) and set MAMP's apache to port 80.

  • klez

    On Windows you use Wamp, on Linux you use Lamp on Mac you use... guess... Mamp!

  • gnarf

    I think that the Zend Server CE is one of the better packages you can install for windows or mac. Comes with instruction caching and what not. Its what I run on my mac. It installs everything in /usr/local/zend and you don't need to worry about software updates messing up your custom apache/php compiles.

  • tim

    There's something to be said for learning to compile things from source all by yourself. Give yourself a weekend to build up a bunch of build scripts.

    I can't tell you how valuable it is to have a bunch of scripts that will more-or-less build the environment you want and need. I actually have several, distinct, AMP stacks running on my Leopard laptop. They mirror the builds running on various client machines.

    It's pretty easy to get started. On the mac, get familiar with MacPorts or Fink so you can install various dependencies. Then grab a recent apache. Build it with a prefix like --prefix=/testing/httpd. Bang on it until you can get it to compile, and you can start it up with "/testing/httpd/bin/apachectl start". Then you can start playing with compiling Apache with OpenSSL, then figure out how to build PHP (with whatever extensions you like).

    It's tedious, but if you write shell scripts to do it for you, you can always come back and make minor tweaks to include any weird esoteric library you'll ever need.

    Even if it never helps you with web development directly, knowing your way around the configure/make/make install dance is a skill you may as well pick up whenever you can.

  • Nerdling

    You can stay up-to-date with the MAMP provided through MacPorts. They have instructions on how to install for as old as Mac OS 10.4.

  • harshal

    I think XAMPP is the best one as i am using it from a quite long and i only have 1 GB RAM and developed a lot projects like facebook twitter and similar .... works fine ... the best XAMPP

  • Frank Farmer

    There is mamp. It's has a mac like interface to.

  • crazyj

    If you're interested in rolling your own MAMP development environment (perhaps the Apple-supplied PHP 5.3 is missing some things you want) I wrote a step-by-step tutorial of my installation at http://www.teamonetickets.com/software/howto-setup-php-apache-mysql-dev-environment-on-snow-leopard.html

  • Cymen

    Another option is to run your web environment(s) in virtual machines. You could use VirtualBox or similar to do this for free (assuming licensing concerns are taken care of). I've started doing this although with a dedicated server running virtualization software (Xen on Linux) and it's wonderful.

    It's certainly different from the other options presented. One concern is if battery life is important -- running a VM would likely consume more resources and reduce battery life. Otherwise, assuming enough resources (memory) is available, it's a great way to keep your separate web sites as completely separate environments.

    Just a thought. I know it's not quite what you asked.

  • Jason

    While the included stuff is nice and things like MAMP work well I have always liked to roll my own so I can be in control of updates and changes.

    Even thought it was written for Leopard Sean's article is a good guide to getting everything setup. Doing this has allowed me to change the installed PHP quickly and easily as necessary.

  • Andrew

    MAMP is ok. It works, but I would prefer to get the default setup working before installing something over the top of it that mucks everything up. I had a really hard time trying to get PHP and MySQL installed on Leopard, but now that Snow Leopard is out, it makes it a lot easier. My recommendation is start with a fresh install of Snow Leopard and find a good tutorial (or separate tutorials) on how to set up Apache, MySQL, and PHP.