Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Mac OS X Leopard and PHP

LEGEND ,
Oct 27, 2007 Oct 27, 2007
Posted in both the Dreamweaver and Dreamweaver Application Development
forums.

Mac OS X 10.5 (Leopard) uses Apache 2.2.6. This is NOT compatible with
the Mac PHP package recommended in all my books. Marc Liyanage
(www.entropy.ch/home) is aware of the problem, but there is no ETA for
an update.

If you have upgraded to Leopard and want to develop PHP pages on your
Mac, you might want to try MAMP (www.mamp.info/en/mamp.html) instead. I
haven't tested it myself yet, but it has a very good reputation.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
TOPICS
Server side applications
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
Good to know. I did upgrade to Leopard. Unlike past OSX upgrades that added functionality, this was clearly a major one down to the core.

According to the technical specs of Leopard OSX 10.5, PHP is already part of the operating system (as well as SQLite, Ruby, Ruby on Rails, Perl, and Python) and the Apache 2 server. Sounds like a perfect OS for PHP development.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
http://www.apple.com/macosx/techspecs/
For Development:
Xcode 3 IDE with Interface Builder 3
Instruments
Dashcode
AppleScript Studio
Automator 2
Shark
GCC compiler and toolset (original project by FSF.org)
DTrace (original project by Sun)
Complete Java JDK, including javac, javadoc, ANT, and Maven tools
Apache web server
AppleScript
Ruby and the Ruby on Rails frameworks
Python
Perl
PHP
SQLite


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2007 Oct 27, 2007
jsteinmann wrote:
> According to the technical specs of Leopard OSX 10.5, PHP is already part of
> the operating system (as well as SQLite, Ruby, Ruby on Rails, Perl, and Python)
> and the Apache 2 server. Sounds like a perfect OS for PHP development.

The preinstalled version of PHP is PHP 4 - a bizarre choice for Apple to
make since PHP 5 was released more than three years ago, and PHP 4
reaches its end of life on 31 December. Moreover, the preinstalled
version is not enabled by default.

In spite of the much trumpeted "ease of use" of Macs, Apple doesn't
actually make life easy for PHP developers. Once things are set up
correctly, though, it is good.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
Keep me updated... cause I want to start developing PHP on my MAC...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
I downloaded MySQL 5 for Mac OSX 10.4 and it worked fine on Leopard. Went to Terminal and typed in php -v and it says I have PHP version 5.2.4 running. I had no issues and I didn't download anything from PHP.net. I was able to follow the directions at http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_05.html to setup the MySQL. It honestly took me less then 5 minutes.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2007 Oct 27, 2007
jsteinmann wrote:
> I downloaded MySQL 5 for Mac OSX 10.4 and it worked fine on Leopard. Went to
> Terminal and typed in php -v and it says I have PHP version 5.2.4 running.

Thank you for pointing that out. I have installed Leopard on two
computers: one a PowerBook that has been upgraded from OS 10.3 to 10.4
and now to 10.5; the other is a Mac mini that came equipped with 10.4,
but was immediately upgraded to 10.5. On the latter machine, I do,
indeed have PHP 5.2.4, although you need to enable it manually. On the
older machine, running php -v in Terminal reports PHP 5.2.4, but the
Apache configuration file still uses PHP 4.

The Mac mini works fine with files stored in
/Library/WebServer/Documents, but not in my username Sites folder.

I'm obviously going to need to do more research, but Apple certainly
hasn't made for a smooth transition to PHP 5.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
I got PHP working with Leopard by modifying the Apache 2 httpd.conf file...

- Finder > Go > Go To Folder
- type in /etc
- then going into the Apache2 folder and copy httpd.conf to the Desktop (it won't let you edit in place).
- Change to a txt file so you can edit
- Find the line that says LoadModule php5_module and remove the #
- Save the file back into the .conf format and drag-drop into Apache 2 folder
- It may ask you to authenticate, click yes, and replace old one.
- Then restart apache by switching personal web sharing off and on in the sharing pref pane.

Your up and running with Apache 2 and Php 5... all built in... life is good.

It would have been nice to have it turned on by default, but hey, that's the way it goes. By the way, error on my part about MySQL. Appeared to work from the terminal, but had a few minor issues (for me anyway). Too many developers out there to not have that resolved yesterday, so I expect a quick fix for that as well.

All in all, I like the changes with Leopard... huge leap forward.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2007 Oct 27, 2007
By the way, I've heard this is nice way to simplify things and get people up and running very quickly to develop in PHP/APACHE/MySQL

http://www.apachefriends.org/en/xampp.html

Haven't tried it, but looks decent... and it's free as expected with open source
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
jsteinmann wrote:
> Your up and running with Apache 2 and Php 5... all built in... life is good.

Not quite. The preinstalled version of PHP 5 doesn't use php.ini. You
need to make a copy of /private/etc/php.ini.default and save it as
php.ini. Then make any changes you need to the php.ini file itself.

Another problem is that the Apache 2 setup won't let you view files in
your personal Sites folder. A guy called Dan Brown has posted details of
how to fix that problem in a comment on my blog:

http://foundationphp.com/blog/2007/10/27/php-and-mac-os-x-leoparda-warning/#comments

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
jsteinmann wrote:
> By the way, I've heard this is nice way to simplify things and get people up
> and running very quickly to develop in PHP/APACHE/MySQL
>
> http://www.apachefriends.org/en/xampp.html

XAMPP is fine for Windows (and Linux, I think). To quote the XAMPP site,
the Mac version is "in the first steps of development. Use at you own
risk!"

A reliable all-in-one solution that works on Leopard is MAMP
(www.mamp.info/en/mamp.html). I tested it yesterday, and it seems fine.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 28, 2007 Oct 28, 2007
That's strange people are having trouble with personal Sites folder... I didn't have that problem.

I heard of some people running into issues like that because the did an Upgrade install so they had 2 versions of apache running at the same time... which is always a bad idea. I never do Upgrade installs because it's just asking for trouble... always Erase and Install with the new OS.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 28, 2007 Oct 28, 2007
Thanks for the heads up about php.ini.

I have to say, having just installed PHP5 on a windows 2003 server, this really wasn't that bad on OSX. PHP has a good community so you usually get answers pretty fast.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
jsteinmann wrote:
> I heard of some people running into issues like that because the did an
> Upgrade install so they had 2 versions of apache running at the same time...
> which is always a bad idea. I never do Upgrade installs because it's just
> asking for trouble... always Erase and Install with the new OS.

It's not surprising that most people do upgrade installs, because that's
the way that Apple does it by default. You don't end up with two
versions of Apache running, but you do have the legacy files of Apache 1.3.

At some stage, I'll probably get round to doing a completely clean
install, but it's a major hassle to move all your files, and then
reinstall every single piece of software.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
jsteinmann wrote:
> Thanks for the heads up about php.ini.

I've been struggling with php.ini all afternoon. It appears that the
only way to copy and rename it in OS X is to enable the Mac root user.
Using sudo doesn't have sufficient privileges.

> I have to say, having just installed PHP5 on a windows 2003 server, this
> really wasn't that bad on OSX. PHP has a good community so you usually get
> answers pretty fast.

It's very easy to get PHP 5 running on Leopard. However, it's not a
fully featured version. It doesn't read a configuration file, and the
default file is inaccessible to an ordinary admistrator. Moreover, if
you want any extra features or to upgrade to a newer version, you need
to compile it yourself. I've succeeded only once in compiling PHP on Mac
OS X. If anything goes wrong it's a complete nightmare.

By comparison, installing PHP on Windows is a breeze. There's an
official Windows installer, or you can use the zip version. It's always
available the same day as the *nix release. Unfortunately, there's no
official binaries distribution for Mac OS X. Mac users have a
considerably tougher time. I test PHP on a Mac only for the benefit of
readers of my books. Otherwise, I wouldn't bother. The hassle over the
years has been too great.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
David Powers wrote:
> I've been struggling with php.ini all afternoon. It appears that the
> only way to copy and rename it in OS X is to enable the Mac root user.
> Using sudo doesn't have sufficient privileges.

It turns out that sudo is sufficient after all. I got the idea about the
need for root user from an old article by Drew McLellan. However, other
simple operations weren't being performed, so I restarted my computer,
and suddenly everything is working again.

It's easy to see how bad information gets spread unintentionally. I had
problems, picked up an idea from what I thought was a reliable source,
and passed it on here and in my blog. For all I know, the information
might have been correct at the time Drew posted it, but it's no longer
applicable. When I've got everything sorted, I'll post detailed
instructions on my site.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 28, 2007 Oct 28, 2007
I was going to say, I didn't have nearly the trouble it sounds like you were having, but it's probably because I didn't know any better either. Keep me posted if you learn new things or add-ons... but fore development purposes I'm pretty well set. Only thing I'm waiting on now it MySQL.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2007 Oct 28, 2007
jsteinmann wrote:
> Only thing I'm waiting on now it MySQL.

Using an upgrade install of Leopard on my laptop, MySQL continued
running just fine. I've got a Mac mini that has nothing on it, so I can
do an erase and install, but that will have to wait until I've sorted
out my taxes. :(

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 29, 2007 Oct 29, 2007
Well, I can't create a connection to MySQL in Dreamweaver CS3... every time I try it crashes. WIthin terminal, it says MySQL is running, and I can show databases so it's there... I just can't create a connection.

This is the Mac OS X 10.4 (PowerPC, 32-bit) package format download.
On the MySQL site, some other people are complaining it's not working as well.
Any suggestions?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 31, 2007 Oct 31, 2007
I cannot connect to MySQL 5.041 through DW CS3 after upgrading to Leopard. MySQL Admin and MySQL Query Browser both can connect and make queries to the database. I just can't connect through Dreamweaver. I get the "MySQL Error#: 2002" error which states "Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2). Problem is there is no such path.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2007 Oct 29, 2007
jsteinmann wrote:
> Well, I can't create a connection to MySQL in Dreamweaver CS3... every time I
> try it crashes. WIthin terminal, it says MySQL is running, and I can show
> databases so it's there... I just can't create a connection.

I haven't tried connecting with Dreamweaver yet. I've been up to my
eyeballs in lots of other things. I'm not sure when I can get round to
it. If you look at a lot of the threads here and in the other DW forum,
an apparent clock change bug is making life a misery for Windows users,
including me (I use Mac mainly for testing purposes).

It's possible that MySQL will need to issue a Leopard build. They needed
to do so for all previous Mac OS upgrades.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 31, 2007 Oct 31, 2007
same
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 27, 2007 Dec 27, 2007
LATEST
For non nerds or starters like me:
To enable PHP and Apache in Leopard:

Apache is simple, go to the sharing panel in system preferences, and enable “Web Sharing”.

PHP requires he use of Terminal (or a BBEdit/Textwrangler if you prefer).

First check you have enabled Root in Leopard.

If not here’s how:

1. Open the Directory Utility: In the Finder, navigate to the Utilities folder (tip: click on the desktop, hit Cmd+Shift+U).
2. Click on the padlock to allow edits.
3. Go Edit > Enable Root Password
4. Enter and re-enter your password.

Now, you are set to access protected areas of the system via the terminal. Probably a good idea to back up any file before you modify it, just in case.

Back to terminal...
when you first start terminal it will show your Admin name followed by a colon,
eg johnsmith:

type “su” the press enter
terminal will the ask for a password,
type in your “password” and press enter.
Note your password doesn’t appear on the screen.

You have two files to alter briefly.

First file:

Type: sudo pico /private/etc/apache2/httpd.conf
and press enter (note the space after sudo and pico).

This opens the file: htpd.conf a hidden file.
Now if you haven’t used this before (I hadn’t and learned on the job), the navigation symbols at the screen bottom with an inverted “v” and a letter , mean to press control and the letter, for example “control X” to exit.

You need to alter 3 lines of code:

1....Use the arrow keys to move down the page...first find a group of coded lines that start with:
LoadModule (there are many lines)..
near the end you’ll find a line:
#LoadModule php5_module modules/libphp5.so

you need to remove the “#” to uncomment and make it active. Position the cursor to the right of the hash and press delete.

2....Next find a line starting with “DirectoryIndex” it probably looks like:
DirectoryIndex index.html

Alter it to this:
DirectoryIndex index.html index.html.var index.php


3....Next find a group of lines that have “ AddType application/x ........”
I seem to remember there were 2 lines like that,
add a line straight after like this:
AddType application/x-httpd-php .php ( note the space between php and .php)

To save your file press “control X” to exit, and “Y” (yes) to save. It then asks if you want to save as a name/different, I just pressed enter to accept the default name.

I went back to check all had been saved by re-opening the file.

Second File:

Type: sudo pico /private/etc/php.ini.default

You only need to alter one line n this file.
Look for a series of lines beginning with a semi-colon like this:
;error_reporting = etc etc etc

Find a line below without a semi colon like this:
error_reporting = E_ALL & -E_NOTICE

then edit out all after “E_ALL” so it looks like this:
error_reporting = E_ALL

Save you work as before.

You can now test PHP works quickly by starting TextEdit and type in:
<?php
phpinfo();
?>

Save the file as “test.php” to your root web directory
on my Mac is” Macintosh HD/Library/WebServer/Documents
(Actually I also saved it to just the WebServer folder).

Start up your browser and enter a URL: http://localhost/test.php

If all has been done as above you’ll get a ful listing of php stuff you probably don’t need to know!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines