<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Apache2, PHP and MySQL on Mac OSX</title>
	<atom:link href="http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/</link>
	<description>Apple Certified Mac Consulting</description>
	<lastBuildDate>Mon, 09 Jan 2012 22:29:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Twila Her</title>
		<link>http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/comment-page-1/#comment-3103</link>
		<dc:creator>Twila Her</dc:creator>
		<pubDate>Tue, 26 Apr 2011 14:43:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.netmojo.ca/blog/2006/07/24/apache2-php-and-mysql-on-mac-osx/#comment-3103</guid>
		<description>You&#039;ve made some decent points there. I looked over the internet with the issue and discovered most people go and also using your website.</description>
		<content:encoded><![CDATA[<p>You&#8217;ve made some decent points there. I looked over the internet with the issue and discovered most people go and also using your website.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent</title>
		<link>http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/comment-page-1/#comment-4</link>
		<dc:creator>Brent</dc:creator>
		<pubDate>Tue, 17 Apr 2007 18:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.netmojo.ca/blog/2006/07/24/apache2-php-and-mysql-on-mac-osx/#comment-4</guid>
		<description>Picking up on that thread, I updated my install of &lt;a href=&quot;http://svn.macports.org/repository/macports/downloads/&quot; rel=&quot;nofollow&quot;&gt;Macports&lt;/a&gt;, and edited the MySQL5 Portfile so that it uses the same location for the socket file as the binary install.

The Portfile is in /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/databases/mysql5, and the line to change is:
&lt;code&gt;
                  --with-unix-socket-path=/private/tmp/mysql.sock \
&lt;/code&gt;

This should allow software linked to this client to access the running MySQL daemon from the binary version.  Build &amp; install:
&lt;code&gt;
sudo port -v install mysql5
&lt;/code&gt;

Then rebuild and reinstall any libraries or programs that were linked to mysql.  For me, thats curl, php and ruby...

&lt;code&gt;
sudo port -v uninstall curl
sudo port -v install curl +openssl +mysql5

sudo port -v uninstall php5
sudo port -v install php5 +apache2 +mysql5

sudo port -v uninstall rb-rubygems
sudo port -v uninstall ruby
sudo port -v install ruby +apache2 +mysql5
sudo port -v install rb-rubygems
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Picking up on that thread, I updated my install of <a href="http://svn.macports.org/repository/macports/downloads/" rel="nofollow">Macports</a>, and edited the MySQL5 Portfile so that it uses the same location for the socket file as the binary install.</p>
<p>The Portfile is in /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/databases/mysql5, and the line to change is:<br />
<code><br />
                  --with-unix-socket-path=/private/tmp/mysql.sock \<br />
</code></p>
<p>This should allow software linked to this client to access the running MySQL daemon from the binary version.  Build &#038; install:<br />
<code><br />
sudo port -v install mysql5<br />
</code></p>
<p>Then rebuild and reinstall any libraries or programs that were linked to mysql.  For me, thats curl, php and ruby&#8230;</p>
<p><code><br />
sudo port -v uninstall curl<br />
sudo port -v install curl +openssl +mysql5</p>
<p>sudo port -v uninstall php5<br />
sudo port -v install php5 +apache2 +mysql5</p>
<p>sudo port -v uninstall rb-rubygems<br />
sudo port -v uninstall ruby<br />
sudo port -v install ruby +apache2 +mysql5<br />
sudo port -v install rb-rubygems<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent</title>
		<link>http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/comment-page-1/#comment-3</link>
		<dc:creator>Brent</dc:creator>
		<pubDate>Tue, 10 Apr 2007 03:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.netmojo.ca/blog/2006/07/24/apache2-php-and-mysql-on-mac-osx/#comment-3</guid>
		<description>I discovered a problem with my binary MySQL installation: it breaks some functionality in &#039;curl&#039; that in turn breaks PEAR.  Running &#039;pear&#039; produces:

PHP Fatal error:  Unable to start curl module in Unknown on line 0


&lt;a href=&quot;http://www.christopher-kunz.de/archives/107-Building-PHP-with-cURL-and-libmysqlclient5.html&quot; rel=&quot;nofollow&quot;&gt;This blog&lt;/a&gt; points out the reason:

&lt;blockquote&gt;
Basically, MySQL saw it fit to link their binary distribution not against OpenSSL (which is probably available on near 100% of unixoid hosts out there), but YaSSL - of which I personally never even heard. Since function names seem to clash between Ya and OpenSSL, we have a nice mixup here that libcurl (which also links against OpenSSL) can&#039;t really digest. It tries to call the YaSSL init function on startup and fails miserably.
&lt;/blockquote&gt;

I&#039;m pretty sure that work around will be to recompile PHP and possibly curl to link against a Macports version of mysql -- although I still intend to keep using the binary install from mysql.  I&#039;ll have to build mysql so that it uses the same socket destination as the binary install; either that or modify the start up scripts of the binary install to use the default socket location of the Macports install.  I&#039;m not sure when I&#039;ll deal with this...</description>
		<content:encoded><![CDATA[<p>I discovered a problem with my binary MySQL installation: it breaks some functionality in &#8216;curl&#8217; that in turn breaks PEAR.  Running &#8216;pear&#8217; produces:</p>
<p>PHP Fatal error:  Unable to start curl module in Unknown on line 0</p>
<p><a href="http://www.christopher-kunz.de/archives/107-Building-PHP-with-cURL-and-libmysqlclient5.html" rel="nofollow">This blog</a> points out the reason:</p>
<blockquote><p>
Basically, MySQL saw it fit to link their binary distribution not against OpenSSL (which is probably available on near 100% of unixoid hosts out there), but YaSSL &#8211; of which I personally never even heard. Since function names seem to clash between Ya and OpenSSL, we have a nice mixup here that libcurl (which also links against OpenSSL) can&#8217;t really digest. It tries to call the YaSSL init function on startup and fails miserably.
</p></blockquote>
<p>I&#8217;m pretty sure that work around will be to recompile PHP and possibly curl to link against a Macports version of mysql &#8212; although I still intend to keep using the binary install from mysql.  I&#8217;ll have to build mysql so that it uses the same socket destination as the binary install; either that or modify the start up scripts of the binary install to use the default socket location of the Macports install.  I&#8217;m not sure when I&#8217;ll deal with this&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent</title>
		<link>http://www.netmojo.ca/2006/07/24/apache2-php-and-mysql-on-mac-osx/comment-page-1/#comment-2</link>
		<dc:creator>Brent</dc:creator>
		<pubDate>Sun, 01 Apr 2007 16:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.netmojo.ca/blog/2006/07/24/apache2-php-and-mysql-on-mac-osx/#comment-2</guid>
		<description>You may want to enable SSL (https) on your local apache install.  To do that, you need to generate a few SSL certificates.  Darwin/Macports installed the openssl config files into /opt/local/etc/openssl.  Change into that directory, and edit the openssl.cnf file.  I changed or added these lines:
&lt;code&gt;
dir             = ./CA                  # Where everything is kept
default_days    = 1365                  # how long to certify for
countryName_default             = CA
stateOrProvinceName_default     = Alberta
localityName_default            = Banff
0.organizationName_default      = NetMojo
commonName_default              = localhost
emailAddress_default            = me@localhost
&lt;/code&gt;

Next, edit misc/CA.pl.  I changed these lines:
&lt;code&gt;
$DAYS=&quot;-days 1365&quot;;     # 3.74 years
$CATOP=&quot;./CA&quot;;
$DIRMODE = 0755;
&lt;/code&gt;

Generate a new Certificate Authority (CA), Certificate Request (a.k.a. private key, for our purposes), and Certificate.  Keep this in mind:
* use a password you&#039;ll remember
* press Enter to accept the defaults from openssl.cnf
* skip the challenge password by pressing Enter
&lt;code&gt;
sudo misc/CA.pl -newca
sudo misc/CA.pl -newreq
sudo misc/CA.pl -signreq
&lt;/code&gt;

Rename the files to something more appropriate:
&lt;code&gt;
sudo mv newkey.pem localhost-key.pem
sudo mv newcert.pem localhost-cert.pem
&lt;/code&gt;

Unencrypt the private key, so you don&#039;t have to enter a password everytime that apache starts up:
&lt;code&gt;
sudo openssl rsa -in localhost-key.pem -out localhost-unenc-key.pem
sudo chown www localhost-unenc-key.pem
sudo chmod 0400 localhost-unenc-key.pem
&lt;/code&gt;

Now edit the file /opt/local/apache2/conf/extra/httpd-ssl.conf.  Here are the lines that I changed:

&lt;code&gt;
SSLCertificateFile /opt/local/etc/openssl/localhost-cert.pem
SSLCertificateKeyFile /opt/local/etc/openssl/localhost-unenc-key.pem
SSLCACertificateFile /opt/local/etc/openssl/CA/cacert.pem
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLSessionCache        shmcb:/private/var/log/httpd/ssl_scache(512000)
SSLMutex  file:/private/var/log/httpd/ssl_mutex
DocumentRoot &quot;/Library/WebServer/Documents&quot;
ServerName localhost:443
ServerAdmin me@localhost
ErrorLog /private/var/log/httpd/ssl_error_log
TransferLog /private/var/log/httpd/ssl_access_log
CustomLog /private/var/log/httpd/ssl_request_log \
&lt;/code&gt;

And finally, edit the /opt/local/apache2/conf/httpd.conf file and uncomment the include line:
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

That should be all.  Start up apache and check the log files in /private/var/log/httpd.  My error_log says:
&lt;code&gt;
[Sun Apr 01 11:49:18 2007] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 01 11:49:18 2007] [notice] Digest: done
[Sun Apr 01 11:49:18 2007] [notice] Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e
DAV/2 PHP/5.2.1 configured -- resuming normal operations
&lt;/code&gt;
And my new ssl_error_log has a warning:
&lt;code&gt;
[Sun Apr 01 11:49:17 2007] [warn] RSA server certificate is a CA certificate
 (BasicConstraints: CA == TRUE !?)
&lt;/code&gt;

And https://localhost works.  Enjoy!</description>
		<content:encoded><![CDATA[<p>You may want to enable SSL (https) on your local apache install.  To do that, you need to generate a few SSL certificates.  Darwin/Macports installed the openssl config files into /opt/local/etc/openssl.  Change into that directory, and edit the openssl.cnf file.  I changed or added these lines:<br />
<code><br />
dir             = ./CA                  # Where everything is kept<br />
default_days    = 1365                  # how long to certify for<br />
countryName_default             = CA<br />
stateOrProvinceName_default     = Alberta<br />
localityName_default            = Banff<br />
0.organizationName_default      = NetMojo<br />
commonName_default              = localhost<br />
emailAddress_default            = me@localhost<br />
</code></p>
<p>Next, edit misc/CA.pl.  I changed these lines:<br />
<code><br />
$DAYS="-days 1365";     # 3.74 years<br />
$CATOP="./CA";<br />
$DIRMODE = 0755;<br />
</code></p>
<p>Generate a new Certificate Authority (CA), Certificate Request (a.k.a. private key, for our purposes), and Certificate.  Keep this in mind:<br />
* use a password you&#8217;ll remember<br />
* press Enter to accept the defaults from openssl.cnf<br />
* skip the challenge password by pressing Enter<br />
<code><br />
sudo misc/CA.pl -newca<br />
sudo misc/CA.pl -newreq<br />
sudo misc/CA.pl -signreq<br />
</code></p>
<p>Rename the files to something more appropriate:<br />
<code><br />
sudo mv newkey.pem localhost-key.pem<br />
sudo mv newcert.pem localhost-cert.pem<br />
</code></p>
<p>Unencrypt the private key, so you don&#8217;t have to enter a password everytime that apache starts up:<br />
<code><br />
sudo openssl rsa -in localhost-key.pem -out localhost-unenc-key.pem<br />
sudo chown www localhost-unenc-key.pem<br />
sudo chmod 0400 localhost-unenc-key.pem<br />
</code></p>
<p>Now edit the file /opt/local/apache2/conf/extra/httpd-ssl.conf.  Here are the lines that I changed:</p>
<p><code><br />
SSLCertificateFile /opt/local/etc/openssl/localhost-cert.pem<br />
SSLCertificateKeyFile /opt/local/etc/openssl/localhost-unenc-key.pem<br />
SSLCACertificateFile /opt/local/etc/openssl/CA/cacert.pem<br />
SSLRandomSeed startup file:/dev/urandom 512<br />
SSLRandomSeed connect file:/dev/urandom 512<br />
SSLSessionCache        shmcb:/private/var/log/httpd/ssl_scache(512000)<br />
SSLMutex  file:/private/var/log/httpd/ssl_mutex<br />
DocumentRoot "/Library/WebServer/Documents"<br />
ServerName localhost:443<br />
ServerAdmin me@localhost<br />
ErrorLog /private/var/log/httpd/ssl_error_log<br />
TransferLog /private/var/log/httpd/ssl_access_log<br />
CustomLog /private/var/log/httpd/ssl_request_log \<br />
</code></p>
<p>And finally, edit the /opt/local/apache2/conf/httpd.conf file and uncomment the include line:<br />
# Secure (SSL/TLS) connections<br />
Include conf/extra/httpd-ssl.conf</p>
<p>That should be all.  Start up apache and check the log files in /private/var/log/httpd.  My error_log says:<br />
<code><br />
[Sun Apr 01 11:49:18 2007] [notice] Digest: generating secret for digest authentication ...<br />
[Sun Apr 01 11:49:18 2007] [notice] Digest: done<br />
[Sun Apr 01 11:49:18 2007] [notice] Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e<br />
DAV/2 PHP/5.2.1 configured -- resuming normal operations<br />
</code><br />
And my new ssl_error_log has a warning:<br />
<code><br />
[Sun Apr 01 11:49:17 2007] [warn] RSA server certificate is a CA certificate<br />
 (BasicConstraints: CA == TRUE !?)<br />
</code></p>
<p>And <a href="https://localhost" rel="nofollow">https://localhost</a> works.  Enjoy!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

