{"id":31,"date":"2009-05-19T14:53:59","date_gmt":"2009-05-19T19:53:59","guid":{"rendered":"http:\/\/24.183.55.167:8101\/wordpress\/?p=31"},"modified":"2011-12-28T15:35:19","modified_gmt":"2011-12-28T21:35:19","slug":"installing-apache-php-mysql-and-memcached-on-freebsd","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/installing-apache-php-mysql-and-memcached-on-freebsd\/","title":{"rendered":"Installing Apache, PHP, MySQL and MemCached on FreeBSD"},"content":{"rendered":"<p>This is my note on how to to install Apache, PHP, MySQL and MemCached on a FreeBSD 7 Box.<\/p>\n<h3>1. MySQL<\/h3>\n<p>Go to the mysql52-server port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/databases\/mysql51-server<\/pre>\n<p>Build the port by typing:<\/p>\n<pre>make BUILD_OPTIMIZED=yes BUILD_STATIC=yes<\/pre>\n<p>Using these two options will speed up the execution time.<\/p>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Open the configuration file: &#8221;&#8217;\/etc\/rc.conf&#8221;&#8217; and add the following at the end of the file:<\/p>\n<pre>mysql_enable=\"YES\"<\/pre>\n<p>Copy the default configuration file:<\/p>\n<pre>cp \/usr\/local\/share\/mysql\/my-medium.cnf \/etc\/my.cnf<\/pre>\n<p>Start mysql manually to avoid having to reboot now by typing:<\/p>\n<pre>\/usr\/local\/etc\/rc.d\/mysql-server start<\/pre>\n<p>Setup the a master password for root user:<\/p>\n<pre>\/usr\/local\/bin\/mysqladmin -u root password 'new-password'<\/pre>\n<p><\/p>\n<h3>2. Apache<\/h3>\n<p>Go to the apache22 port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/www\/apache22<\/pre>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Open the configuration file: &#8221;&#8217;\/etc\/rc.conf&#8221;&#8217; and add the following at the end of the file:<\/p>\n<pre>apache22_enable=\"YES\"<\/pre>\n<p>Add the following in: &#8221;&#8217;\/boot\/loader.conf&#8221;&#8217;<\/p>\n<pre>accf_http_load=YES<\/pre>\n<p><\/p>\n<h3>3. PHP<\/h3>\n<h4>3.1 PHP5<\/h4>\n<p>Go to the php5 port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/lang\/php5<\/pre>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Make sure the APACHE (Build Apache module) option is checked.<\/p>\n<h4>3.2 PHP5 Extentions<\/h4>\n<p>Note: If you need to install PDF-Lite, please do the following:<\/p>\n<pre>fetch ftp:\/\/ftp.swin.edu.au\/gentoo\/distfiles\/PDFlib-Lite-7.0.2.tar.gz\r\nsudo mv PDFlib-Lite-7.0.2.tar.gz \/usr\/ports\/distfiles\/<\/pre>\n<p>Go to the php5 extensions port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/lang\/php5-extensions<\/pre>\n<p>Make sure sockets is selected.<\/p>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Install the php.ini file:<\/p>\n<pre>cp \/usr\/local\/etc\/php.ini-dist \/usr\/local\/etc\/php.ini<\/pre>\n<h4>3.3 Enable PHP in Apache<\/p>\n<h5>3.3.1 httpd.conf<\/h5>\n<p>Edit the Apache configuration file &#8221;&#8217;\/usr\/local\/etc\/apache22\/httpd.conf&#8221;&#8217; and add the following lines to the end of the file:<\/p>\n<pre>AddType application\/x-httpd-php .php\r\nAddType application\/x-httpd-php-source .phps<\/pre>\n<p>Replace this line:<\/p>\n<pre>DirectoryIndex index.html<\/pre>\n<p>by the following:<\/p>\n<pre>DirectoryIndex index.php index.html<\/pre>\n<h5>3.3.2 httpd-languages.conf<\/h5>\n<p>Edit the Languageconfiguration file &#8221;&#8217;\/usr\/local\/etc\/apache22\/extra\/httpd-languages.conf&#8221;&#8217; and add the following lines to the end of the file:<\/p>\n<pre>AddDefaultCharset On<\/pre>\n<p>Startup the Apache:<\/p>\n<pre>\/usr\/local\/etc\/rc.d\/apache22 start<\/pre>\n<p><\/p>\n<h3>4. MEMCached<\/h3>\n<p>Go to the pecl-memcache port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/databases\/pecl-memcache<\/pre>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Go to the memcached port directory by typing the command:<\/p>\n<pre>cd \/usr\/ports\/databases\/memcached<\/pre>\n<p>Install the port by typing:<\/p>\n<pre>make install clean<\/pre>\n<p>Open the configuration file: &#8221;&#8217;\/etc\/rc.conf&#8221;&#8217; and add the following at the end of the file:<\/p>\n<pre>memcached_enable=\"YES\"<\/pre>\n<p>To start using MemCached without rebooting, type:<\/p>\n<pre>\/usr\/local\/bin\/memcached -d -u nobody<\/pre>\n<p>&#8211;Derrick<\/p>\n<p><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>This is my note on how to to install Apache, PHP, MySQL and MemCached on a FreeBSD 7 Box. 1. MySQL Go to the mysql52-server port directory by typing the <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/installing-apache-php-mysql-and-memcached-on-freebsd\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7,144,6],"tags":[8,171,13,11,9,172],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-sever-problem","category-technology","tag-apache","tag-freebsd","tag-install","tag-memcached","tag-mysql","tag-php"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-v","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":41,"url":"https:\/\/icesquare.com\/wordpress\/installing-apache-php-mysql-and-memcached-on-os-x\/","url_meta":{"origin":31,"position":0},"title":"Installing Apache, PHP, MySQL and MemCached on OS X","author":"Derrick","date":"May 19, 2009","format":false,"excerpt":"This is my note on how to to install Apache, PHP and MySQL on a an OS X box. Although some of these applications are come with the operating systems, it is always good to know how to upgrade them to the latest version. 1. Apple Developer Tools and Mac\u2026","rel":"","context":"In &quot;Server Problems&quot;","block_context":{"text":"Server Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/sever-problem\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":603,"url":"https:\/\/icesquare.com\/wordpress\/weird-php-error-after-freebsd-port-upgrade\/","url_meta":{"origin":31,"position":1},"title":"Weird PHP Error after FreeBSD port upgrade (PHP Warning:  PHP Startup: Unable to load dynamic library)","author":"Derrick","date":"April 6, 2010","format":false,"excerpt":"Today I upgraded the port on my FreeBSD box using portmaster tools: portmaster -Dai After that, I found that the PHP gave the following weird error: php -v PHP Warning: PHP Startup: Unable to load dynamic library '\/usr\/local\/lib\/php\/20060613\/memcached.so' - \/usr\/local\/lib\/php\/20060613\/memcached.so: Undefined symbol \" php_session_create_id\" in Unknown on line 0 PHP\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3514,"url":"https:\/\/icesquare.com\/wordpress\/freebsdphp-does-not-work-after-upgrading-apache-to-2-2-27\/","url_meta":{"origin":31,"position":2},"title":"[FreeBSD]PHP does not work after upgrading Apache to 2.2.27","author":"Derrick","date":"April 11, 2014","format":false,"excerpt":"I upgraded the Apache to 2.2.27 on my FreeBSD box via portmaster. The upgrade went very smooth. After the upgrade, I found that Apache no longer rendered the PHP page correctly. In the other words, it displayed the source code of the PHP files instead of executing the code. Before\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3489,"url":"https:\/\/icesquare.com\/wordpress\/install-usrports-doc-inappropriate-file-type-or-format\/","url_meta":{"origin":31,"position":3},"title":"install: \/usr\/ports\/&#8230;\/doc\/: Inappropriate file type or format","author":"Derrick","date":"March 5, 2014","format":false,"excerpt":"While I tried to upgrade both of my FreeBSD server (9 & 10) today, I got the following error: install: \/usr\/ports\/...\/doc\/: Inappropriate file type or format Actually, here is the complete error message: ===> Staging for memcached-1.4.17_1 ===> memcached-1.4.17_1 depends on shared library: libevent-2.0.so - found ===> Generating temporary packing\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3474,"url":"https:\/\/icesquare.com\/wordpress\/the-easiest-way-to-improve-the-performance-of-mysql-server-on-freebsd\/","url_meta":{"origin":31,"position":4},"title":"The easiest way to improve the performance of MySQL server on FreeBSD","author":"Derrick","date":"February 2, 2014","format":false,"excerpt":"There are many different ways to improve the MySQL performance. In general, it breaks down into two different categories: Server side and client side. On the server side, we can optimize the database and table structure, such as indexing the columns etc. On the client side, we can optimize the\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/02\/speedometer.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/02\/speedometer.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/02\/speedometer.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/02\/speedometer.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2014\/02\/speedometer.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":1028,"url":"https:\/\/icesquare.com\/wordpress\/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file\/","url_meta":{"origin":31,"position":5},"title":"MySQL: Starting MySQL&#8230;.. ERROR! The server quit without updating PID file","author":"Derrick","date":"November 12, 2010","format":false,"excerpt":"This step-by-step guide is mainly for FreeBSD, however the idea is the same for Linux. Every once a while, when I update my FreeBSD box, the system likes to shutdown my MySQL server. Therefore, I need to start it again after the update is done. Unfortunately, the upgrade process is\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":16,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":2414,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/31\/revisions\/2414"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}