Entropy.ch Discussion Forums Forum Index Entropy.ch Discussion Forums
Discussion forums about Mac OS X software development.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Installing PHP 5.2 on Mac OS X Server v10.4.8
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> PHP on Mac OS X
View previous topic :: View next topic  
Author Message
pluta



Joined: 03 Nov 2006
Posts: 7
Location: Bochum, Germany

PostPosted: Thu Nov 30, 2006 15:51    Post subject: Installing PHP 5.2 on Mac OS X Server v10.4.8 Reply with quote

How to install PHP 5.2 for Apache 1.3 (entropy-php-5.2.0-3.tar.gz) on Mac OS X Server v10.4.8.

1. Disable the PHP 4 Module (which is currently at version 4.4.4)
Server Admin:
Services: Web: Settings: Modules tab
Uncheck "php4_module" and click Save.

2. Download and unpack PHP 5.2 and run the installer.

The phpinfo() function now confirms that PHP 5.2 is active.
However, on trying to connect to MySQL you get a "Could not connect to database." error message.

The default socket location for MySQL on Mac OS X Server v10.4 is /var/mysql/mysql.sock.
The move to place the mysql.sock file in /var/mysql/ was done for security purposes.

You can find the details in two articles on Apple's Server Support Website:
(1) Mac OS X Server 10.4: Issues connecting PHP to MySQL
http://docs.info.apple.com/article.html?artnum=301457
(2) Mac OS X Server 10.4.4: Improvements to Apache/PHP/MySQL interaction
http://docs.info.apple.com/article.html?artnum=302977

Reverting the socket location to /tmp/mysql.sock makes little sense from a security standpoint.
Telling PHP where the new socket file is is a much better solution.

3. Tell PHP 5.2 where to look for the MySQL socket file.
The php.ini file for PHP 5.2 is located at /usr/local/php5/lib/php.ini.
Open php.ini in your preferred text editor. We are using the Pico editor here.
--In Terminal: sudo pico /usr/local/php5/lib/php.ini
Find the [MySQL] section, and change the mysql.default_socket directive.
--In Pico editor: mysql.default_socket = /var/mysql/mysql.sock
Save the changes and exit the Pico editor.
Finally, restart Apache.

Hope this helps!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
liyanage
Site Admin


Joined: 22 May 2003
Posts: 1104
Location: Zurich, Switzerland

PostPosted: Thu Nov 30, 2006 15:56    Post subject: Reply with quote

Thanks a lot for the nice explanation. I will link to this from the main PHP page.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
sigurdur



Joined: 05 Dec 2006
Posts: 1

PostPosted: Tue Dec 05, 2006 14:00    Post subject: Reply with quote

A follow-up to this excellent post:

If you have webmail activated in Mac OS X Server, the Server Admin will reactivate php4. This will in return cause Apache to crash with a bus error when both php5 and php4 are active. To solve this, it is necessary to edit the httpd.conf file.

In Terminal:
Code:
cd /etc/httpd
sudo cp httpd.conf httpd.conf.old
sudo pico httpd.conf


find the two lines that mention php4

Code:
LoadModule php4_module           libexec/httpd/libphp4.so


and

Code:
AddModule mod_php4.c


and delete them. Commenting them out is not enough since Server Admin will uncomment them and reactivate php4 if you have Webmail active.

Restart Apache.
Back to top
View user's profile Send private message Send e-mail
trampoline



Joined: 13 Aug 2006
Posts: 28

PostPosted: Fri Feb 09, 2007 0:25    Post subject: Web DAV prob.... Reply with quote

That is a very nice explaination I think I posted up something last year about this I should have sticied it !
I have a small problem with Web DAV in that because PHP5 launches on it's own I have no way of ordering it's loading into Apache and as a result Web DAV is broken, how can I get PHP5 into the Httpd config file (also in the web server admin) so that I can load it befor Web DAV which is the problem If I can get it to load first web DAV will work ??? any Idea's how to get PHP5 into the HTTPD.conf file I tried but it Broke the HTTPD.conf file and I had to actually replace the httpd.conf file from backup ???....
Back to top
View user's profile Send private message
anthony.abraira



Joined: 08 Mar 2007
Posts: 1

PostPosted: Thu Mar 08, 2007 21:16    Post subject: Issue with 10.4.8 (Client Package) Reply with quote

So sorry to disturb, since I am sure you get these kind of emails all the time. I must admit that I am not very well versed in Unix and up until recently I had been using one of your earlier package releases of php4 for my Powerbook G4 that I have just recently and sold. I bought a MacBook Pro with Intel and trying to implement php so that I can run a local installation of phpWCMS. The idea is to do all the development locally (which is much faster) and then upload the finished website online. With that out of the way, let me break down what I have done up to this point.

Successful Installation MySQL

1. I installed the MySQL package from
http://dev.mysql.com/downloads/mysql/4.1.html

2. Afterwards I followed your instructions and then ran the unix commands off of the terminal and by the looks of it, everything went smoothly.

Initial attempt to install php5 for Apache 2

I was unsure which version of Apache I was running, (running Standard OSX Tiger 10.4. so I attempted to install the php5 for Apache 2. This created two results. The first one was that the Personal Web Server feature was unable to start. Looking through the Event Log, it appeared that it had difficulty initializing. I apologize but I didn't save the log. Long story short I had to delete the php5 from /usr/local directory and then removed the +entropy-php.conf file. Then I was able to run the Personal Web Server. It is important to note also that the phpinfo test did not work when I loaded a local page.

3. Attempted to Install php5 for Apache 1


This installed and initialized properly as indicated by the logs

Code:
Code:
/usr/sbin/apachectl stop: httpd stopped
Processing config directory: /private/etc/httpd/users/*.conf
 Processing config file: /private/etc/httpd/users/+entropy-php.conf
 Processing config file: /private/etc/httpd/users/anthonyabraira.conf
/usr/sbin/apachectl start: httpd started



But the page still failed to load the phpinfo results. The page did have the source code when I checked the 'View Source.' I tried going to my phpWCMS setup script that was also a .php file but that only displayed the text.

Thus I am a little at a loss here. If you can assist me, in getting this up and running I would really appreciate it and (of course throw a little donation money your way for your troubles.)

I thank you for taking the time to read this lengthy note and look forward to your reply.


~anthony

p.s. will it be simpler to just revamp my machine to run under 10.4.8 Server?

_________________
anthony
gifted designer but deficient in code
Back to top
View user's profile Send private message AIM Address
pluta



Joined: 03 Nov 2006
Posts: 7
Location: Bochum, Germany

PostPosted: Sat Mar 10, 2007 20:03    Post subject: Reply with quote

My instructions only refer to Mac OS X Server v10.4.8. Mac OS X Server comes preinstalled with PHP and MySQL, which are optimized for security and speed. I recommend using Mac OS X Server. The Server version is much easier to configure and maintain than the Client version using Apple's Server Admin application. However, the current PHP version of Mac OS X Server is 4.4.4. Hence my tutorial on how to install PHP 5.2.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rupert Reid



Joined: 09 Apr 2007
Posts: 4
Location: UK

PostPosted: Thu Apr 12, 2007 16:39    Post subject: Reply with quote

Please would someone give me detailed Terminal instructions on how to disable PHP4 and then activate PHP5 after installing Entropy PHP5.

Rgds Rupert
_________________
I will greet each day with love in my heart for this the greatest secret of succes in all ventures. Muscle can split a shield and even destroy life but only the unseen power of love can open the hearts of men and...
isinglive.co.uk & cantoenvivo.es
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Rupert Reid



Joined: 09 Apr 2007
Posts: 4
Location: UK

PostPosted: Thu Apr 12, 2007 16:40    Post subject: PHP4 & ERntropy PHP5 conflict: Apache will not start. Reply with quote

Please would someone give me detailed Terminal instructions on how to disable PHP4 and then activate PHP5 after installing Entropy PHP5.

Rgds Rupert
_________________
I will greet each day with love in my heart for this the greatest secret of succes in all ventures. Muscle can split a shield and even destroy life but only the unseen power of love can open the hearts of men and...
isinglive.co.uk & cantoenvivo.es
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
pluta



Joined: 03 Nov 2006
Posts: 7
Location: Bochum, Germany

PostPosted: Thu Apr 12, 2007 16:51    Post subject: Disabling PHP 4 Reply with quote

If the PHP 4 module is active (it is inactive by default), it must be disabled before installing PHP 5.2. Simply follow the first part of my tutorial using Apple's Server Admin application.

1. Disable the PHP 4 Module (which is currently at version 4.4.4)
Server Admin:
Services: Web: Settings: Modules tab
Uncheck "php4_module" and click Save.

After having disabled PHP 4, go ahead and install PHP 5.2 (which is active after the installation has been completed).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
crespowu



Joined: 25 Jan 2008
Posts: 1

PostPosted: Fri Jan 25, 2008 9:32    Post subject: Reply with quote

Great guide.Thank you very much.
Back to top
View user's profile Send private message
RobLewis



Joined: 16 Feb 2008
Posts: 3
Location: Puget Sound, WA

PostPosted: Sun Feb 17, 2008 21:34    Post subject: php5 with WebMail? Reply with quote

sigurdur wrote:
A follow-up to this excellent post:

If you have webmail activated in Mac OS X Server, the Server Admin will reactivate php4. This will in return cause Apache to crash with a bus error when both php5 and php4 are active. To solve this, it is necessary to edit the httpd.conf file.

In Terminal:
Code:
cd /etc/httpd
sudo cp httpd.conf httpd.conf.old
sudo pico httpd.conf


find the two lines that mention php4

Code:
LoadModule php4_module           libexec/httpd/libphp4.so


and

Code:
AddModule mod_php4.c


and delete them. Commenting them out is not enough since Server Admin will uncomment them and reactivate php4 if you have Webmail active.

Restart Apache.


(I'm on X Server 10.4.11 now but I presume the issues are the same.)

Is there any way to install php5 without losing WebMail? How about just turning WebMail off, running the entropy.ch installer, and turning it back on? Does SquirrelMail work with php5?

I'm quite loath to tamper excessively with my X Server installation, but if deleting the LoadModule and AddModule lines that refer to php4 is the only way, then I guess I'll have to. (Could there be some way of commenting them out such as by adding extra text to the lines such that they would be invisible to Server Admin?)

I got into all this because I wanted to experiment with Drupal, which requires php's GD library, which apparently is either missing or outdated in the X Server default installation. I don't have anything mission-critical that depends on php except SquirrelMail and phpMyAdmin (which apparently does work under php5). As a general rule, how likely is it that apps break when php is switched from 4 to 5?
Back to top
View user's profile Send private message
Khedron



Joined: 29 Jun 2003
Posts: 8
Location: Stockholm, Sweden

PostPosted: Tue Feb 19, 2008 10:54    Post subject: PHP5 and Webmail no problem Reply with quote

I'm running a Mac OS X Server 4.11 with Entropy PHP 5.2.4, Apache 1.3 and webmail without any problem. As far as I know you have to choices:
1. delete the lines as sigurdur describes
2. or stop using Server Admin to restart Apache (instead, in the terminal: "sudo apachectl restart"

(Disclaimer: I have upgraded Squirrelmail to latest version, 1.4.13.)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
RobLewis



Joined: 16 Feb 2008
Posts: 3
Location: Puget Sound, WA

PostPosted: Tue Feb 19, 2008 15:44    Post subject: Re: PHP5 and Webmail no problem Reply with quote

Khedron wrote:
I'm running a Mac OS X Server 4.11 with Entropy PHP 5.2.4, Apache 1.3 and webmail without any problem. As far as I know you have to choices:
1. delete the lines as sigurdur describes
2. or stop using Server Admin to restart Apache (instead, in the terminal: "sudo apachectl restart"

(Disclaimer: I have upgraded Squirrelmail to latest version, 1.4.13.)


Thanks. I don't want to hijack this thread, but I'd be very interested to know the procedure for updating SquirrelMail.
Back to top
View user's profile Send private message
pluta



Joined: 03 Nov 2006
Posts: 7
Location: Bochum, Germany

PostPosted: Sun Mar 23, 2008 14:08    Post subject: Apple's Security Update 2008-002 Reply with quote

Apple's Security Update 2008-002 upgrades the preinstalled version of PHP to version 4.4.8 and the preinstalled version of Apache to version 1.3.41. If you are using Apache 1.3, installing Security Update 2008-002 will not affect your PHP 5.2 module from Entropy.

You may, however, run into problems, if you are using Apache 2. Help is available in another thread (Apple Security Update Killed my localhost Server).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kolyn_Kryw



Joined: 24 Apr 2008
Posts: 3

PostPosted: Thu Apr 24, 2008 14:44    Post subject: Reply with quote

Hi guys !!! Very Happy I am new here

It's thread really very intresting,thanks for it.
_________________
Link Building Packages
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> PHP on Mac OS X All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group