Switching... » PHP http://switch.richard5.net How to build your Mac into a internet server using open source software Mon, 25 May 2009 14:13:02 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 New location Apache and PHP in new instruction set http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/ http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/#comments Wed, 31 Jan 2007 20:32:27 +0000 Richard5 http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/ Just wanted to see if there are any objections to move the Apache and PHP installations from their current location in ‘/Library/’ to ‘/usr/local/’

The layout for Apache will become:

<layout DIYMacServer>
    prefix:        /usr/local/apache2
    exec_prefix:   ${prefix}
    bindir:        ${exec_prefix}/bin
    sbindir:       ${exec_prefix}/bin
    libdir:        ${exec_prefix}/lib
    libexecdir:    ${exec_prefix}/modules
    mandir:        ${prefix}/man
    sysconfdir:    /etc/httpd/
    datadir:       /var/www
    installbuilddir: ${datadir}/build
    errordir:      ${datadir}/error
    iconsdir:      ${datadir}/icons
    htdocsdir:     ${datadir}/htdocs
    manualdir:     ${datadir}/manual
    cgidir:        ${datadir}/cgi-bin
    includedir:    ${prefix}/include
    localstatedir: /var
    runtimedir:    ${localstatedir}/run
    logfiledir:    ${localstatedir}/log/httpd
    proxycachedir: ${localstatedir}/cache/httpd
</Layout>

This brings everything in-line with normal other installs. The configuration is as it was with the original Apache in ‘/etc/httpd‘ and the log, cache and pid file are all in ‘/var‘. Although I’m still having doubts about the datadir, I would have put it in ‘/var/www/‘ but on the normal OS X install it would be in ‘/Library/WebServer/‘. What do you think ?

PHP5 will be located in ‘/usr/local/php5‘, the php.ini file will be located in ‘/etc‘.

I hope to open up the new site tomorrow if all goes well…

]]>
http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/feed/ 5
MySQL updated to version 5.0.27 http://switch.richard5.net/2006/10/29/mysql-updated-to-version-5027/ http://switch.richard5.net/2006/10/29/mysql-updated-to-version-5027/#comments Sun, 29 Oct 2006 10:24:35 +0000 Richard5 http://switch.richard5.net/2006/10/29/mysql-updated-to-version-5027/ MySQL Community Server has been updated to a new release which is mostly a bugfix release for an ABI incompatibility with earlier releases. This bug hasn’t affected me and it doesn’t really have to affect you if you don’t use this functionality, check the bug report to make sure that this is the case.

Please not that if you run the binary installer it’s still necessary to compile the source afterwards because the shared library bug isn’t solved yet. Also don’t forget to copy the data directory to the new version of MySQL or it might look like you lost all your databases.

Please note that MySQL has created a fork for the distribution. The paying customers get MySQL Enterprise Server which has been updated to 5.0.28 (don’t know why there is the difference in versions). To read more about the differentiation between the MySQL Enterprise Server and the MySQL Community Server, read Kaj Arnö’s blog.

As an added bonus I would like to point out that if you are still using the mysql extensions instead of the mysqli extensions (i stands for improved) you should take a look at the MySQL wiki article which will help you convert your application to the new module. They even got a script which will convert your source for you. If you still need convincing why you should convert please read this old article on the Zend site.

]]>
http://switch.richard5.net/2006/10/29/mysql-updated-to-version-5027/feed/ 0
Updated to v2 on my own server http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/ http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/#comments Wed, 13 Sep 2006 13:02:27 +0000 Richard5 http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/ I used yesterday to recompile Postfix, Courier-Auth, Apache and PHP with the 5.0.24a MySQL libraries. I just used my own instructions to compile everything.

I first did Postfix and Courier-auth as they would cause the least problems when it would go wrong. My backup mailserver would still receuve all mail and forward it to me when the mailserver is back online. It all went without a hitch, just did a restart of the programs and all was running as expected.

Apache posed an issue, how to compile and install, followed by compiling PHP without disturbing all the people looking at my sites. In the end it was simple. Compile and install Apache2, don’t restart Apache so the old version keeps running but the new software is available on disk. Then compile and install PHP using the new Apache installation files and when that is done restart Apache and all would be fine. Well that’s what I thought…

There was a small error in the modules that I included in the httpd.conf. Some of them, all concerning authentication, where rewritten and given different names. I was still trying to load the old ones as I didn’t update my httpd.conf to reflect these changes. So Apache2 wouldn’t start. I just commented out the old modules and added the new ones in my httpd.conf and presto, Apache 2.2.3 and PHP 5.1.6 are now running on my server, together with Postfix 2.2.3.

They’ve been running for almost a day now and I haven’t gotten any complaints yet.

If you are still running “ISP in a box” version 1 and want to upgrade but are still a bit afraid on how to do this let me know and I’ll help out.

Update:
Just found out there was an error, got a call on the phone from some of my friends that they couldn’t email anymore. When checking the logfiles I foud out I forgot a step after compiling and installing Courier auth:

sudo chmod o+x /usr/local/var/spool/authdaemon

In the logfile there was the error:

SASL authentication failure: cannot connect to Courier
      authdaemond: Permission denied

Which means I didn’t follow my own instructions !

]]>
http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/feed/ 4
PHP updated to version 5.1.6 http://switch.richard5.net/2006/08/30/php-updated-to-version-516/ http://switch.richard5.net/2006/08/30/php-updated-to-version-516/#comments Wed, 30 Aug 2006 18:57:04 +0000 Richard5 http://switch.richard5.net/2006/08/30/php-updated-to-version-516/ While I was looking for some info on PHP I noticed that it got upgraded again very soon after the upgrade to 5.1.5 earlier this month. You can read all about the issues, bugs, etc. in the changelog. There was nothing really bothering me and I don’t see any problems for current 5.1.4 users that would warrant an update because of security reasons. But I wanted to let you know about this anyway and decide for yourself.

Updating is as easy as following the installation instructions already on the site. Just get the newer sourcecode from www.php.net and compile it.

]]>
http://switch.richard5.net/2006/08/30/php-updated-to-version-516/feed/ 0
Finished installation instructions on MySQL, Apache and PHP http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/ http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/#comments Sun, 13 Aug 2006 20:13:53 +0000 Richard5 http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/ This as taken me much, much longer than I ever planned it to take. First there was the introduction of the Intel based Mac’s that I needed to comprehend. Secondly the many problems I’d encountered with the shared library support in the MySQL as many of you have read in previous posts. Third there was the happy occasion of the birth of my daughter which prevented me from spending much time behind the screen.

But it’s done, I’ve finally finished the instruction for installing (and compiling) MySQL 5, Apache 2 and PHP 5. Hope you are able to use them well.

I’m currently working on the instructions for the mailserver as there are some tweaks needed to get that working with the current setup. There where some issues with Intel based Macs and SSL support but I’ve got that solved. Hope to get that finished in a very short time… (not naming dates here, getting careful… ;-) )

]]>
http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/feed/ 1
Update on PHP, upgrade to 5.1.4 http://switch.richard5.net/2006/05/09/update-on-php-upgrade-to-514/ http://switch.richard5.net/2006/05/09/update-on-php-upgrade-to-514/#comments Tue, 09 May 2006 20:08:16 +0000 Richard5 http://switch.richard5.net/2006/05/09/update-on-php-upgrade-to-514/ Well did I miss this one completely. I thought I had myself subscribed to all the announcement mailinglists of all the software I use in my setup so I would not miss any important updates or security issues. Because I was trying to download the source code of PHP to retry the installation procedure to see if I missed something I noticed the difference in version numbers. I was still expecting version 5.1.2 and I noticed I missed 2 versions as there is now version 5.1.4. Somehow 5.1.4 followed 5.1.3 very quickly because of some bugs that where found. You can read all about the issues, bugs, etc.. in the changelog.

I tried updating one of my servers to see if there was anything wrong with the installation procedure and to write down how to upgrade. It’s basically the same as the compiling instructions for 5.1.2. Just get the newer sourcecode from www.php.net
and compile it. Don’t forget to install the XML library as well if you are upgrading from PHP4.

Another thing I found out when trying to install was that the install script wants to use wget instead of the standard installed curl on OS X for installing PEAR. You can download a compiled wget from this blog entry. Instead of copying wget in /usr/local/bin/ just copy it into /usr/sbin/ which is included in the default path.

]]>
http://switch.richard5.net/2006/05/09/update-on-php-upgrade-to-514/feed/ 0
Almost finished the PHP compilation instructions http://switch.richard5.net/2006/04/14/almost-finished-the-php-compilation-instructions/ http://switch.richard5.net/2006/04/14/almost-finished-the-php-compilation-instructions/#comments Fri, 14 Apr 2006 09:46:27 +0000 Richard5 http://switch.richard5.net/2006/04/14/almost-finished-the-php-compilation-instructions/ I’ve got a lot of feedback on the instructions I posted on compiling PHP5 on Mac OS X. First reactions where about the PEAR installation problem which I missed completely (as I haven’t used PEAR yet, forgot to test this). Secondly I got a lot of feedback on the use of the options, extensions and libraries I had chosen. Some where obsolete, not in use anymore or replaced by newer ones. I’ll try to explain why this happened:

I had started compiling PHP on the Mac starting with PHP4, I had found some outdated instructions on how to compile it on Mac which with a little tweaking got it to work. Changing that to instructions on how to compile PHP5 looked pretty straightforward. But I haven’t actively developed in PHP for a year or two and completely missed the changes that happened between PHP4 and PHP5. Which meant that I missed some of the details that where needed to get a proper PHP5 working environment.

Thanks to all the feedback and the email conversations I had I think I’ve got a proper basic setup as it is now. After I’m done with rewriting the mail-server documentation so it reflects the changes I made to, for instance, the MySQL install paths. I’m going to try to document installing more options and libraries that people might like to use with their PHP installation.

If you have any ideas or comments on this PHP installation let me know, I’m always open to suggestions.

]]>
http://switch.richard5.net/2006/04/14/almost-finished-the-php-compilation-instructions/feed/ 0
Preview of PHP installation http://switch.richard5.net/2006/04/06/preview-of-php-installation/ http://switch.richard5.net/2006/04/06/preview-of-php-installation/#comments Thu, 06 Apr 2006 11:00:36 +0000 Richard5 http://switch.richard5.net/2006/04/06/preview-of-php-installation/ As promised earlier I wanted to have the documentation ready for installing PHP from source from scratch. Just starting with source code for PHP and the libraries required.

I think I covered most of the essential libraries nad options needed for running most of the PHP based applications. If you like more libraries or options included in the build process let me know and I’ll see what I can do for you. Please motivate your choice…

Donations are still going strong, got 2 big donations this week. The Intel Mac mini is getting closer every day…

]]>
http://switch.richard5.net/2006/04/06/preview-of-php-installation/feed/ 0
Compiling PHP 5.1.2 on the Mac http://switch.richard5.net/2006/03/10/compiling-php-512-on-the-mac/ http://switch.richard5.net/2006/03/10/compiling-php-512-on-the-mac/#comments Fri, 10 Mar 2006 20:30:54 +0000 Richard5 http://switch.richard5.net/2006/03/10/compiling-php-512-on-the-mac/ Well I’ve got it working, it took some time because there was an older library in the PHP4 directory structure from Server Logistics that didn’t like PHP5 ! The XML library needed an upgrade to be included into PHP5 so I first had to solve that issue to get it all working. The only library I had to exclude was SNMP for the same reason as I had to leave it out from the PHP 4.4.2 compilation. The rest of the libraries that are used from the original PHP4 installation from Server Logistics so please install that before you try this upgrade.

First you need to download the sourcecode for the new libxml2 library, you can get it from the GNOME ftp server. I’ve downloaded and used the latest version which was at this time version 2.6.23.

Extract the archive into a directory and run the following commands in a Terminal ./configure and make as we’ve done so many times already. When it is finished compiling you can install the library by running sudo make install and when that is done you’ll have to create a copy of the library in the directory /Library/PHP5/lib/ which you can do with the command sudo cp /usr/local/lib/libxml2.2.6.23.dylib /Library/PHP5/lib

When this is done you can start downloading from www.php.net. Extract the source archive into a directory and use the Terminal to execute the following commands:

sed 's/\(LIBS="\)\(-lpspell \$LIBS"\)/\1-laspell \2/' configure > configure.1
mv configure.1 configure
chmod a+x configure

This makes some changes to which library gets used during compilation just like the PHP4 script. Now you are ready to run the configure script. Please feel free to remove options you don’t see any need for, I tried to get everything in there that Server Logistics provided in their package.

./configure \
--prefix=/Library/PHP5 \
--with-apxs2=/Library/Apache2/bin/apxs \
--disable-cgi \
--enable-magic-quotes \
--disable-short-tags \
--with-openssl=/usr \
--with-zlib \
--with-zlib-dir=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--enable-dba \
--enable-dbase \
--enable-dbx \
--enable-dio \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir=/Library/PHP4 \
--with-png-dir=/Library/PHP4 \
--enable-gd-native-ttf \
--with-gettext=/Library/PHP4 \
--with-iconv=/usr \
--with-iconv-dir=/usr \
--with-imap=/Library/PHP4 \
--with-imap-ssl=/usr \
--enable-mbstring \
--with-mcrypt=/Library/PHP4 \
--with-mhash=/Library/PHP4 \
--with-mysql=/Library/MySQL \
--enable-embedded-mysqli \
--with-ncurses=/usr \
--with-pspell=/Library/PHP4 \
--enable-shmop \
--with-openssl-dir=/usr \
--enable-soap \
--enable-sockets \
--enable-wddx \
--with-expat-dir=/Library/Apache2 \
--with-xsl=/Library/PHP5 \
--enable-yp \
--enable-shared \
--enable-static

If this ends then

sed '/INCLUDES/s/^\(.*\)\( -I\/Library\/PHP4\/include \)\(.*\)$/\1 \3 \2/' Makefile > Makefile.1
mv Makefile.1 Makefile

When ready you can try to compile, you’ll be getting a lot of warnings and it will take a while. Compile by issuing the command:
make

When you are ready and made proper backups of your production environment you can issue the install command:

sudo make install

This updates your httpd.conf file as well by adding the entries PHP5, but it doesn’t remove any entries for PHP4. You’ll have to remove them yourself and restart Apache.

Please note that there isn’t a php.ini file in the configured directory /Library/PHP5/lib. You can copy one from the source directory or the one from your PHP4 installation.

]]>
http://switch.richard5.net/2006/03/10/compiling-php-512-on-the-mac/feed/ 0
Compiling PHP 4.4.2 on the Mac http://switch.richard5.net/2006/03/05/compiling-php-442-on-the-mac/ http://switch.richard5.net/2006/03/05/compiling-php-442-on-the-mac/#comments Sun, 05 Mar 2006 17:53:56 +0000 Richard5 http://switch.richard5.net/2006/03/05/compiling-php-442-on-the-mac/ Server Logistics has a great package for installing the (L/M)AMP applications stack on Mac OS X, the only drawback is that they don’t upgrade their packages as I would like to see it happen. Especially when there are security issues with older version of PHP, MySQL or Apache. I’ve been able to get a more recent version of Apache compiled then they released and the last few days I’ve been struggling to get PHP compiled. I wanted to recompile PHP4 and PHP5 to be able to provide some choices. I’ve successfully compiled PHP4 and kept most of the Server Logistics structure intact. Most of the credits go to Bjarne D Mathiesen who wrote some documents and scripts in Danish I used to get this working.
The only thing I had to disable to get it compile was the support for SNMP, it is something I guess not many need so I just removed it from the list of options to include.

Get the source for PHP 4.4.2 from www.php.net and extract the archive into a separate directory. When that’s done open a Terminal window and go to the directory you extracted the archive in. You now need to change the configure script with the following commands:

sed 's/\(LIBS="\)\(-lpspell \$LIBS"\)/\1-laspell \2/' configure > configure.1
mv configure.1 configure
chmod a+x configure

This makes some changes to which library gets used during compilation. Now you are ready to run the configure script. Please feel free to remove options you don’t see any need for, I tried to get everything in there that Server Logistics provided in their package.

./configure \
--prefix=/Library/PHP4 \ --enable-shared \
--with-apxs2=/Library/Apache2/bin/apxs \
--disable-cgi \
--enable-magic-quotes \
--disable-short-tags \
--with-openssl=/usr \
--with-zlib-dir=/usr \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-sockets \
--enable-wddx \
--enable-yp \
--enable-trans-id \
--enable-track-vars \
--with-mysql=/Library/MySQL \
--with-ldap=/usr \
--with-iodbc=/Library/PHP4 \
--with-gettext=/Library/PHP4 \
--with-gd \
--with-jpeg-dir=/Library/PHP4 \
--with-png-dir=/Library/PHP4 \
--with-tiff-dir=/Library/PHP4 \
--enable-gd-native-ttf \
--with-ttf=/Library/PHP4 \
--with-freetype-dir=/Library/PHP4 \
--with-t1lib=/Library/PHP4 \
--without-xpm-dir \
--with-pdflib=/Library/PHP4 \
--with-mcrypt=/Library/PHP4 \
--with-curl=/usr \
--with-iconv=/usr \
--enable-mime-magic \
--with-pspell=/Library/PHP4 \
--with-expat-dir=/Library/Apache2 \
--enable-xslt \
--with-xslt-sablot=/Library/PHP4 \
--with-xmlrpc \
--with-dom=/Library/PHP4 \
--with-dom-xslt=/Library/PHP4 \
--with-dom-exslt=/Library/PHP4 \
--enable-dbx \
--with-imap=/Library/PHP4 \
--with-imap-ssl=/usr \
--enable-dbase \
--with-bz2=/usr \
--with-java \
--enable-ucd-snmp-hack \
--with-mhash=/Library/PHP4 \
--with-ming=/Library/PHP4 \
--enable-shmop \
--with-gmp=/Library/PHP4 \
--enable-dio \
--enable-bcmath \
--enable-dba \
--with-cdb

This will take some time to complete. When it’s finished you need to change the Makefile with the following command:

sed '/INCLUDES/s/^\(.*\)\( -I\/Library\/PHP4\/include \)\(.*\)$/\1 \3 \2/' Makefile > Makefile.1
mv Makefile.1 Makefile

This changes the order inwhich the include files are scanned to prevent compiler errors with the Freetype 1 and 2 include files.

Now you are ready to run the make command. Please go and make some coffee as this will run for a long time…

When the compilation is finished you can install the new PHP4 version by running:

sudo make install

When this is finished you need to restart Apache2 to activate the new version of PHP4.

I haven’t found a simple way to test all the included options I just ran phpinfo() to see if everything was included. If you know of a script to test all the options please let me know and I’ll test it out and include it with this blog entry for others to benefit.

Please note that you should already have the original PHP4 package from Server Logistics installed or this won’t work !

]]>
http://switch.richard5.net/2006/03/05/compiling-php-442-on-the-mac/feed/ 6