{"id":170,"date":"2006-03-07T14:18:54","date_gmt":"2006-03-07T19:18:54","guid":{"rendered":"http:\/\/blog.elharo.com\/blog\/?p=170"},"modified":"2006-03-22T09:57:57","modified_gmt":"2006-03-22T14:57:57","slug":"converting-a-mini-to-a-server-part-3-mysql-and-php","status":"publish","type":"post","link":"https:\/\/www.elharo.com\/blog\/software-development\/databases\/2006\/03\/07\/converting-a-mini-to-a-server-part-3-mysql-and-php\/","title":{"rendered":"Converting a Mini to a Server, Part 3: MySQL and PHP"},"content":{"rendered":"<p>To summarize what has gone before, I now have <a href=\"\/blog\/mac\/2006\/03\/07\/converting-the-mini-to-a-server-preliminaries\/\">headless, network access to a Mac X86 Mini<\/a>, and have <a href=\"\/blog\/software-development\/web-development\/2006\/03\/07\/converting-a-mini-to-a-server-part-2-installing-apache\/\">successfully installed Apache 2.0.55<\/a>. The next step is to install MySQL, PHP, and WordPress; then copy The Cafes and elharo.com from the old server to the Mini.<br \/>\n<!--more--><\/p>\n<p>First up, MySQL. This almost couldn&#8217;t be easier. MySQL AB publishes a precompiled binary for X86 Macs, and it&#8217;s installed using the usual Mac installer. This is about the easiest server side install I&#8217;ve ever had to do. The only thing that could be better would be to not include a separate install for the autolauncher. Oh, and it should probably ask you for a database root password while installing rather than letting it be set later. Let&#8217;s do that before I forget:<\/p>\n<p><samp>mini:\/usr\/local\/mysql elharo$ .\/bin\/mysqladmin -u root password mynewpassword<br \/>\nmini:\/usr\/local\/mysql elharo$ .\/bin\/mysql -u root -pmynewpassword<br \/>\nWelcome to the MySQL monitor.  Commands end with ; or \\g.<br \/>\nYour MySQL connection id is 5 to server version: 5.0.18-standard<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the buffer.<\/p>\n<p>mysql> DELETE FROM mysql.user WHERE User = &#8221;;<br \/>\nQuery OK, 2 rows affected (0.00 sec)<\/p>\n<p>mysql> FLUSH PRIVILEGES;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<br \/>\n<\/samp><\/p>\n<p>But honestly these are nickel-and-dime issues compared to what you have to go through with most server side software.<\/p>\n<p>Next up is PHP. I&#8217;ll need to build this one from source. <\/p>\n<p><samp>mini:~\/Desktop\/php-5.1.2 elharo$ .\/configure &#8211;with-apxs2=\/usr\/httpd\/bin\/apxs &#8211;with-mysql=\/usr\/local\/mysql &#8211;prefix=\/opt\/php5 &#8211;with-libxslt &#8211;with-tidy<br \/>\ncreating cache .\/config.cache<br \/>\nchecking for Cygwin environment&#8230; no<br \/>\nchecking for mingw32 environment&#8230; no<br \/>\n&#8230;<br \/>\ncreating main\/internal_functions_cli.c<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| License:                                                           |<br \/>\n| This software is subject to the PHP License, available in this     |<br \/>\n| distribution in the file LICENSE.  By continuing this installation |<br \/>\n| process, you are bound by the terms of this license agreement.     |<br \/>\n| If you do not agree with the terms of this license, you must abort |<br \/>\n| the installation process at this point.                            |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/samp><\/p>\n<p><samp>Thank you for using PHP.<\/samp><\/p>\n<p>Now onto make:<\/p>\n<p><samp>mini:~\/Desktop\/php-5.1.2 elharo$ make<br \/>\n\/bin\/sh \/Users\/elharo\/Desktop\/php-5.1.2\/libtool &#8211;silent &#8211;preserve-dup-deps &#8211;mode=compile gcc  -Iext\/libxml\/ -I\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/ -DPHP_ATOM_INC -I\/Users\/elharo\/Desktop\/php-5.1.2\/include -I\/Users\/elharo\/Desktop\/php-5.1.2\/main -I\/Users\/elharo\/Desktop\/php-5.1.2 -I\/usr\/include\/libxml2 -I\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/date\/lib -I\/usr\/local\/mysql\/include -I\/usr\/include\/tidy -I\/Users\/elharo\/Desktop\/php-5.1.2\/TSRM -I\/Users\/elharo\/Desktop\/php-5.1.2\/Zend  -no-cpp-precomp  -I\/usr\/include -g -O2  -c \/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c -o ext\/libxml\/libxml.lo<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c: In function &#8216;php_libxml_streams_IO_open_wrapper&#8217;:<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c:264: warning: pointer targets in passing argument 1 of &#8216;xmlParseURI&#8217; differ in signedness<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c:265: warning: pointer targets in passing argument 1 of &#8216;xmlStrncmp&#8217; differ in signedness<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c:265: warning: pointer targets in passing argument 2 of &#8216;xmlStrncmp&#8217; differ in signedness<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c: In function &#8216;_php_list_set_error_structure&#8217;:<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c:433: warning: pointer targets in passing argument 1 of &#8216;xmlStrdup&#8217; differ in signedness<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/libxml\/libxml.c:433: warning: pointer targets in assignment differ in signedness<br \/>\n&#8230;<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/tidy\/tidy.c:1084: warning: pointer targets in initialization differ in signedness<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/tidy\/tidy.c: In function &#8216;zif_tidy_get_output&#8217;:<br \/>\n\/Users\/elharo\/Desktop\/php-5.1.2\/ext\/tidy\/tidy.c:1100: warning: pointer targets in initialization differ in signedness<br \/>\nmake: *** [ext\/tidy\/tidy.lo] Error 1<br \/>\n<\/samp><\/p>\n<p>Hmm, those libxml warnings are troublesome. I wonder if Tidy and\/or libxsl assuming something they shouldn&#8217;t be about the signedness of a Mac? I don&#8217;t think I have to have libxsl or libtidy right now so let&#8217;s reconfigure and try again without them.<\/p>\n<p><samp>mini:~\/Desktop\/php-5.1.2 elharo$ make clean<br \/>\nfind . -name \\*.lo -o -name \\*.o | xargs rm -f<br \/>\nfind . -name \\*.la -o -name \\*.a | xargs rm -f<br \/>\nfind . -name \\*.so | xargs rm -f<br \/>\nfind . -name .libs -a -type d|xargs rm -rf<br \/>\nrm -f libphp5.la sapi\/cli\/php libs\/libphp5.bundle modules\/* libs\/*<br \/>\nmini:~\/Desktop\/php-5.1.2 elharo$ .\/configure &#8211;with-apxs2=\/usr\/httpd\/bin\/apxs &#8211;with-mysql=\/usr\/local\/mysql &#8211;prefix=\/opt\/php5<br \/>\nloading cache .\/config.cache<br \/>\nchecking for Cygwin environment&#8230; (cached) no<br \/>\nchecking for mingw32 environment&#8230; (cached) no<br \/>\nchecking for egrep&#8230; (cached) grep -E<br \/>\nchecking for a sed that does not truncate output&#8230; (cached) \/usr\/bin\/sed<br \/>\nchecking host system type&#8230; i686-apple-darwin8.5.3<br \/>\nchecking target system type&#8230; i686-apple-darwin8.5.3<br \/>\nchecking for gcc&#8230; (cached) gcc<br \/>\n&#8230;<br \/>\nBuild complete.<br \/>\n(It is safe to ignore warnings about tempnam and tmpnam).<br \/>\n<\/samp><\/p>\n<p>OK. That worked. I&#8217;ll have to remember that I don&#8217;t have libtidy or libxslt installed in this. Finally install:<\/p>\n<p><samp>mini:~\/Desktop\/php-5.1.2 elharo$ sudo make install<br \/>\nPassword:<br \/>\nInstalling PHP SAPI module:       apache2handler<br \/>\n\/usr\/httpd\/build\/instdso.sh SH_LIBTOOL=&#8217;\/usr\/httpd\/build\/libtool&#8217; libs\/libphp5.so \/usr\/httpd\/modules<br \/>\n\/usr\/httpd\/build\/libtool &#8211;mode=install cp libs\/libphp5.so \/usr\/httpd\/modules\/<br \/>\ncp libs\/libphp5.so \/usr\/httpd\/modules\/libphp5.so<br \/>\n<em>Warning!  dlname not found in \/usr\/httpd\/modules\/libphp5.so.<\/em><br \/>\nAssuming installing a .so rather than a libtool archive.<br \/>\n&#8230;<br \/>\nWrote PEAR system config file at: \/opt\/php5\/etc\/pear.conf<br \/>\nYou may want to add: \/opt\/php5\/lib\/php to your php.ini include_path<br \/>\nInstalling PDO headers:          \/opt\/php5\/include\/php\/ext\/pdo\/<br \/>\n<\/samp><\/p>\n<p>OK. Let&#8217;s load up a simple PHP page and see if PHP is working or if I need to restart Apache or some such. Nope. Doesn&#8217;t work. It&#8217;s just displaying the PHP file, not interpreting it. Let&#8217;s restart the server. OK. Now something&#8217;s changed. It isn&#8217;t showing anything at all instead of showing the PHP source code. At least that means it understands there&#8217;s something didfferent about a .phtml file. Let&#8217;s look in the error log and see what we see. <samp>[Tue Mar 07 13:46:33 2006] [notice] child pid 18205 exit signal Bus error (10)<br \/>\n[Tue Mar 07 13:46:37 2006] [notice] child pid 18206 exit signal Bus error (10)<br \/>\n[Tue Mar 07 13:46:51 2006] [notice] child pid 18207 exit signal Bus error (10)<\/samp><\/p>\n<p>Could that be the problem? Let&#8217;s reload the <tt>.php<\/tt> page one more time and see if that adds an error. Yep, that&#8217;s it all right. Now the question becomes, why is that happening? Googling on the error message is sometimes productive. This <a href=\"http:\/\/lists.freebsd.org\/pipermail\/freebsd-ports\/2005-February\/021142.html\">thread<\/a> may be relevant, but doesn&#8217;t seem to have a definite answer.  <\/p>\n<p>OK. Figured it out. I hadn&#8217;t installed a <tt>php.ini<\/tt> in <tt>\/usr\/ocal\/lib<\/tt>. You&#8217;d think that would have been installed by default but I guess not. But now it&#8217;s back to showing the PHP source code? Why?<\/p>\n<p>OK. Figured that out. I had not yet added the line <\/p>\n<p><code>AddType application\/x-httpd-php .php .phtml<\/code><\/p>\n<p>to <tt>httpd.conf<\/tt>. Again the installer should have done this, but it didn&#8217;t. Believe it or not, it took me longer than it should have to figure out the problem because of yet another variation of the <a href=\"http:\/\/cafe.elharo.com\/java\/the-nastiest-bug\/\">nastiest bug<\/a>. This time, I had <tt>httpd.conf<\/tt> files from two different web servers open in several different terminal windows, and I checked for the AddType line in what I thought was the new server but was in fact the old server.<\/p>\n<p>In any case, I now seem to have a functioning Apache 2\/MySQL 5\/PHP 5 system compiled natively for the Mac Mini. The next step is to set up the virtual hosts, install WordPress in each one, and load the old data. This seems like as a good a time as any to update to the latest version of WordPress, and since I have it on good authority that 2.0.2 is coming out <em>very<\/em> soon, I think I&#8217;ll wait for that before moving ahead. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>To summarize what has gone before, I now have headless, network access to a Mac X86 Mini, and have successfully installed Apache 2.0.55. The next step is to install MySQL, PHP, and WordPress; then copy The Cafes and elharo.com from the old server to the Mini.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[410],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-databases","tag-flash"],"_links":{"self":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":0,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}