Getting those Apache/PHP settings just right

| |

Warren is the guy who has been running Gallery for a few years now. Me? I ran it at my previous job but I didn't get into it much.

Cybernet PCCybernet PCNow I'm running Drupal and on the default Apache/PHP install, PHP is limited to 8MB of RAM. That works fine for most everything... but when you get into graphics processing, it isn't even close. Graphics Processing? The image upload (and photo gallery) module for Drupal take an uploaded image file and then generates a preview size (640x480) image and a thumbnail (125x125?) image. It can use ImageMagick or the GD image processing packages.

I uploaded some smaller images and it worked fine. I tried a .jpg about 478K in size and blam, it didn't work and I just got a blank result page. Hmmm, what's going on?

Checked my virtual host's error log and saw:

PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4180 bytes)

Ok, I up it to 16MB but that didn't help because I got:

PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2560 bytes)

Cybernet boxCybernet boxOk, I decided to bump it up to 64MB. That seems to have worked and I tested it with 10 more images... with the largest being 1MB in file size with a resolution of 2,304x1728. I hope 64MB of RAM for PHP will handle anything I can throw at it.

Hey Warren... what did you have your PHP setting set for when you uploaded that huge image of downtowm Manhattan after 9/11? Would 64MB cut it for that?

You can see the Cybernet Zero Footprint PC gallery I created during the testing. Hey, they were the only images I had laying around at the time. :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Scared Of Apache, PHP, MySQL? Try MAMP.

Recent articles on Mac360 discussed options to create web pages and manage web sites.

The range of choices is from free to complex, ridiculously easy to mildly complex. One area of complexity is now shattered forever on the Mac. Apache, MySQL, PHP. MAMP. Did I mention that MAMP is free?

MAMP stands for Mac, Apache (the most popular web server), MySQL (the most popular relational database), and PHP (the most popular application scripting engine for the web).

All together, MAMP represents a platform and a suite of tools that can produce some powerful web sites and run hundreds of applications.

The problem has always been that getting those tools to run on your Mac was a hassle for the average user. Mac OS X began to change that by integrating the Apache web server and the PHP engine.

PHP is just there but it doesn’t work unless you change some of the Apache configuration files. Apache is there and just works, but you have to figure out how to turn it on in System Preferences.

MySQL is not included, though it’s a free download. The install, though not impossible difficult, is tricky if you have no experience setting up a database on a Unix machine (like the Mac).

See? You want to run all those easy to set up and run content management systems, forums, and so on-- but they require Apache, MySQL and PHP.

MAMP to the rescue. The WebEdition folks have created a Mac version of LAMP. Linux, Apache, MySQL, and PHP called MAMP.

MAMP installs all the basic applications you need, including another version of Apache, MySQL, and PHP, right inside your Applications folder. Set up could not be easier unless Tera did it for you (she won’t; I asked).

Double click on the MAMP icon, and MAMP starts up MySQL and Apache, and opens a web-browser control panel. Welcome to the world of Apache, MySQL, and PHP.

After that, it’s all point and click and drag and drop. Now you can install the best of content management systems and other applications that used to be the domain of the geekier Mac users (like Tera).

ExpressionEngine Core (free), WordPress (free), Joomla (free), Mambo (free), phpBB (free), MediaWiki (free), Moodle (free), ATutor (free) and most any of the gazillions of free applications in the PHP MySQL world, all run on your Mac.

How? They all run right on your Mac using OS X Tiger. Yes, you can learn all about config.php, or httpd.conf, or php.ini if you want (it’s good to know anyway), but you don’t need to.

You can test all the PHP MySQL applications you want without fear of screwing up something. Get tired of MAMP? Drag and drop to the trash. It’s that simple.

MAMP is free (not sure if I mentioned that) and is simply a packaged version of the latest Apache, PHP, MySQL, phpMyAdmin, and other applications, all of which are free and can be downloaded separately.

MAMP just makes the process much easier, and lets you try out PHP applications right on your Mac. Cool, huh?

I downloaded the latest version late last night and had it up and running in about two minutes (I’m a slow learner; after all, if I’m eating for two, I’m learning for two). Installation of EE, Joomla, WordPress and phpBB (a forums bulletin board application) in about two minutes each.

Once you’re set up, your Mac becomes the web server, and Safari (or, Your Browser Here) becomes your window to the application, as most of them feature web-based controls.

What’s even cooler, is you don’t have to be connected to the internet. Safari connects to what is known as “localhost” which is really, well, it’s your Mac.

PowerBook and iBook owners will love MAMP. Take MAMP and do a show and tell of your web page design without uploading to a web site.

What’s happened with MAMP is called progress. What was once the domain of technical types is now point and click for the rest of us. That’s how life should be.

The Da Vinci Code

Worzie's picture

Well I already talked with

Well I already talked with Scott since his posting but for others reading: I set a memory_limit = 60M in the php.ini and for a speedier PHP I also use the script cache eAccelerator.

I have noticed that different architectures using the same software sometimes have different requirements. With way more RAM now I still have to use a huge phpmem as I did with about half the ram in previous installs.


Scott Dowdle's picture


I don't get it. You seem to be saying that if you have more system RAM that a PHP script should need less RAM to run. Why would that be the case?

Worzie's picture

Nothing New

I think it's just because the software didn't stop there with the featres; it has gotten bloated in the mean time.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.