getting entropy php to play nice in os x 10.5 leopard
Recently I installed OS X 10.5 Leopard. I wanted to remove the packaged install of PHP and use the Entropy install from Marc Liyanage instead.
Unfortunately I ran in to an error during install:
Install Failed
The following install step failed: run postflight script for Entropy PHP. Contact the software manufacturer for assistance.
After failing to get a solution on google, I decided to fix this myself.
I’m running Apache 2 and it turns out that is where the problem is coming from. Now that I have fixed the issue, I am running a perfectly good Entropy package PHP install, and you can too by following these steps.
Edit: After posting this article, two commenters (see below) suggested a much simpler fix. Simply run the following command:
sudo ln -s /etc/apache2 /etc/httpd
My article goes in to editing files which is really unnecessary if you don’t care about having a symlink pointing to your apache2 directory (and I don’t see why you would care). However if you want to go the more complicated route, I have left my original instructions in tact below.
steps to follow
The very first thing you need to do is enable PHP in the httpd.conf file.
Figure out where this file is located.
Check /etc/apache2/httpd.conf.
If that fails, open Terminal and search for the file by typing:
locate httpd.conf
If that fails, you’ve got bigger problems and should stop now and do some google research.
Once you do locate the file, edit it and uncomment the following line (remove the pound sign from the begining of the line):
#LoadModule php5_module libexec/apache2/libphp5.so
- Download the Entropy package for OS X 10.5 and follow all installation instructions.
- After running through the installation steps, if you do not get the afore mentioned error, you should be good to go. However if you do receive the postflight error, read on.
- Open up Terminal
- Type the following command
cd /usr/local/php5/bin
- Edit the activate-entropy-php.py file using sudo and your favorite text editor (you’ll have to enter your system’s password here):
sudo vi activate-entropy-php.py
- Lines 16 and 18 contain the following code:
httpd_conf_symlink = '/etc/httpd/users/+entropy-php.conf'
- Change httpd to apache2 so that the lines look like this:
httpd_conf_symlink = '/etc/apache2/users/+entropy-php.conf'
- Save and quit editing:
:wq
- Run the Python script, you should not get any errors after it finishes running:
sudo python activate-entropy-php.py
- Restart your server. You can do this by opening System Preferences > Sharing > Uncheck Web Services if it’s checked, then check the box again (or check it for the first time… you get the drift).
Now you just need to create a file in your Sites directory and test the PHP.
Change to your sites directory and create a test file:
cd ~/Sites vi test.php
Add the following PHP to the file:
<php echo phpinfo(); >
Save the file:
:wq
Now open up a browser and type in this address:http://localhost/~[YOUR_NAME_HERE]/test.php
If you see information about your PHP installation, you are good to go. If not, you’re screwed and should consider going to the Entropy forums for further assistance.
Tom Hillman says:
March 4, 2008 at 6:14 am
Hi,
It might be a bit neater to simply add a symbolic link, eg
/etc/http –> /etc/apache2
so that all future packages expecting http end up in the right place as well.
OS X 10.5 server seems to use /etc/http, so hopefully I won’t encounter this error.
Joe says:
March 4, 2008 at 8:03 am
Good point… I may have over complicated things a bit
Tom says:
March 4, 2008 at 9:51 pm
thanks. Your fix worked perfectly on OSX 5.2.1
Joe says:
March 5, 2008 at 8:00 am
Tom: glad to hear the fix worked for you.
enrico says:
March 10, 2008 at 6:14 pm
Hi, i’ve got problem since the first step
This is what i get when i type in: locate httpd.conf
/********************************/
/Library/Application Support/Apple/ParentalControls/ContentFiltering/httpd.conf
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/configs/lighttpd.conf
/private/etc/apache2/httpd.conf
/private/etc/apache2/original/httpd.conf
/********************************/
So no:#LoadModule php5_module
Help!
Ted says:
March 14, 2008 at 9:51 pm
enrico - you’re just looking at the file list. you need to open the file /private/etc/apache2/httpd.conf in a text editor.
Ted says:
March 14, 2008 at 9:54 pm
this worked reasonably well for me, also, but now it seems that the mcrypt extension doesn’t load. am I doing something silly, or is that a bug in the package?
Rob Dodson says:
April 25, 2008 at 10:46 am
Hi Joe,
When Tom said the following:
“It might be a bit neater to simply add a symbolic link, eg
/etc/http –> /etc/apache2
so that all future packages expecting http end up in the right place as well.”
Could you provide an example for how to do this? I’m completely new to both PHP and Macs so all of this is a bit confusing for me.
Tapas sarangi says:
May 5, 2008 at 5:35 pm
Hi, after following your instructions, I installed entropy php5, and now
I cant even see my localhost on the browser. What did i do wrong ?
Joe says:
May 5, 2008 at 9:27 pm
Tapas: I just replied to this comment via email. Have you confirmed that your server is actually running?
It sounds strange to me that following the above instructions would break your apache server.
Rob:
Of course you’ll need to replace the target_filename with the actual file name. Same goes for symlink_filename.
Joe says:
May 5, 2008 at 9:30 pm
Enrico: You do have an httpd.conf file. As you posted in your comment, the results returned after running the locate command show this:
/private/etc/apache2/httpd.conf
Which is the path of your httpd.conf file, and the file itself.
Andy N says:
May 14, 2008 at 2:19 pm
Thanks for this article Joe.
Just to clarify, when you gave Rob those instructions on how to set up the symlink, does that replace any particular step(s) in your original instructions?
I only ask because Tom wrote “It might be a bit neater to simply add a symbolic link”, suggesting that by doing that, it replaces some of the steps you outlined in your article. If so… which ones?
shonagh says:
May 14, 2008 at 4:58 pm
hi there,
i am verrry new to this and particularly new to using the terminal.
however i really want to learn how to use php, and am following lynda.com’s training tut.
i have done everything step by step but had the postflight script error so i followed the above instructions - exactly.
i changed the two lines of code, in the terminal, as outlined above in number 6 & 7 - i then wasnt too sure how to save and quit but i think i managed it somehow. then i tried to run the python part - but that would work for me. so i quit the terminal and opened it up again and now nothing works - it can not open the file ‘activate-entropy-php.py’ and it shows a page of ~’s when i try to do anything. have i upset my computer forever? is there any way of finding this file again so i can reverse what i have done?
forgive me, anyone who is thinking..who is the dumb ass.. i really am very new to all of this!
thank you for any help at all.
kindest
shonagh
x
Kevin Teljeur says:
May 15, 2008 at 9:24 am
Man, you saved me a world of pain, and to think I should know this stuff already. Well, I guess I’d have started digging into the files listed in the console eventually, but following your instructions was much, much faster
@Shona: read the instructions very carefully - it requires some command line knowledge, particularly of using sudo but it’s straightforward enough. I like using Textwrangler for the edits, do not use TextEdit under any circumstances!
Rakesh Luthra says:
June 14, 2008 at 8:32 am
Like Tom suggested, the easiest and straight forward solution to the postflight script error is just one statement in terminal window:
sudo ln -s /etc/apache2 /etc/httpd
Joe says:
June 14, 2008 at 9:32 am
Thanks Tom and Rakesh Luthra, i finally got around to making an edit to the article by including the symlink instructions.
Rogelio says:
June 20, 2008 at 12:01 pm
Im not experienced in bash, I started the “sudo vi activate-entropy-php.py” was copying from your text and pasting to the top of the page instead of where I was supposed to, was not able to undo and didnt know how to revert,closed the page and wanted to do it again. and got this, I dont want to make this worse and want to fix it.
E325: ATTENTION
Found a swap file by the name “.activate-entropy-php.py.swp”
owned by: root dated: Fri Jun 20 09:33:39 2008
file name: /usr/local/php5/bin/activate-entropy-php.py
modified: YES
user name: root host name: Rogelios-Mac-Pro.local
process ID: 517
While opening file “activate-entropy-php.py”
dated: Fri Aug 31 15:37:04 2007
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r activate-entropy-php.py”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “.activate-entropy-php.py.swp”
to avoid this message.
Swap file “.activate-entropy-php.py.swp” already exists!
Swap file “.activate-entropy-php.py.swp” already exists! (Q)uit, (A)bort:
– More –
John Parker says:
June 24, 2008 at 12:48 pm
EbAz72 Blogs rating, add your blog to be rated for free
http://blogsrate.net
myk says:
July 19, 2008 at 12:34 pm
Not sure is this is related, I got PHP working fine, but only in my Sites folder. If I set up a symlink to another folder, and hit a page located there, I only get a text page of my php code. So FollowSymLinks is working, but apache isn’t passing the code to PHP. I also checked php.ini and short_open_tag = On
So I’m at a loss as to why things work in my Sites folder but not through a SymLink
Any ideas?
Alex says:
August 16, 2008 at 4:21 am
Your blog is interesting!
Keep up the good work!
Paul Orchard says:
August 26, 2008 at 2:04 pm
Thank you so much for this quick fix.