BSD How to Install Apache, MySQL, PHP, and phpMyAdmin on FreeBSD

83 Comments

(20130728 – This post has been amended to reflect changes in the most recent versions of software — iceflatline)

This post will describe how to install and configure Apache, MySQL, PHP and phpMyAdmin on FreeBSD for basic local web development. Once set up, you’ll be able to use your “AMP” server to do web development, code testing, maintain local copies of your web sites, etc.

The software discussed in this post are available as free and open source under various licensing structures. The versions of software discussed in this post are as follows:

  • FreeBSD 9.1-RELEASE
  • apache24-2.4.6
  • mysql-server-5.6.12
  • php5-5.4.17
  • php5-extensions-1.7
  • phpMyAdmin-4.0.4.1
  • WordPress v3.5.2
  • The following steps discussed in this post assume you have the FreeBSD Ports Collection installed. If not, you can install it by using the following commands:

    portsnap fetch
    portsnap extract
    

    If the Ports Collection is already installed, make sure to update it:

    portsnap fetch update
    

    Okay, let’s get started. All commands are issued as the root user or by simulating the root user by using the command su. While building the various ports you should accept all default configuration options unless otherwise instructed.

    Install Apache

    Navigate to the Apache server port and build it:

    cd /usr/ports/www/apache24
    make install clean
    

    Once Apache has been successfully installed, add the following line to /etc/rc.conf so that the Apache server will start automatically at system boot.

    echo 'apache24_enable="YES"' >> /etc/rc.conf
    

    Now let’s start Apache to make sure it works:

    /usr/local/etc/rc.d/apache24 start
    

    Point your web browser to the host name or IP address of the FreeBSD host you’ve installed Apache on and you should see the venerable “It Works.”

    Install MySQL.

    Now let’s build the MySQL server:

    cd /usr/ports/databases/mysql55-server
    make install clean
    

    Add the following line to /etc/rc.conf:

    echo 'mysql_enable="YES"' >> /etc/rc.conf
    

    And start the mysql server:

    /usr/local/etc/rc.d/mysql-server start
    

    Then set a password for the MySQL root user:

    /usr/local/bin/mysqladmin -u root password 'your-password'
    

    Install PHP

    Next, we’ll build PHP. Before we proceed, however, we need to add a configuration option so that PHP build includes support for the Apache server. Start with the following commands:

    cd /usr/ports/lang/php5
    make config
    

    A menu should come up allowing you to select/deselect various build options. You should select “Build Apache module” by highlighting the option with the arrow keys and hitting the space bar, then hit Enter, which should bring you back to the command prompt. Now proceed with building the port:

    make install clean
    

    Now let’s add the requisite extensions to PHP to round out its capabilities. Before we build this port though we’ll want to add support for both MySQL and MySQLi (an improved interface to MySQL) in order to communicate with the MySQL server.

    cd /usr/ports/lang/php5-extensions/
    make config
    

    In the corresponding menu you should select “MySQL database support” and “MySQLi database support,” then proceed with building the port:

    make install clean
    

    Install phpMyAdmin

    phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL from your web browser. phpMyAdmin supports a wide range of operations with MySQL, including managing databases, tables, fields, relations, indexes, users, permissions, etc., from an easy-to-use web page, while you still have the ability to directly execute any SQL statement from the command line if you prefer. Installing phpMyAdmin is optional but it’s nice tool to have. Here again we’ll want to add support for MySQL and MySQLi before building the port:

    cd /usr/ports/databases/phpmyadmin/
    make config
    

    Here you should ensure that both “MYSQL M(DB_connect): PHP MySQL support via mysql client” and “MYSQLI M(DB_connect) PHP Improved MySQL client support” are selected, then proceed with building the port:

    make install clean
    

    Configuration

    Now that we have the requisite ports built and installed it’s time to configure them. First, let’s create the file /usr/local/etc/php.ini to hold our PHP options. The simpliest way to do this is to copy the file /usr/local/etc/php.ini-development which will add the default settings for new PHP installations. This configuration is suitable for development purposes, but NOT necessarily for production purposes. If your plans include a production server, then among other things, and before going online with your site, you should consider copying /usr/local/etc/php.ini-production instead and consult the recommendations at http://php.net/manual/en/security.php.

    cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini
    

    Now let’s configure Apache. Open the file /usr/local/etc/apache24/httpd.conf in your favorite editor and look for the following line:

    DirectoryIndex index.html
    

    And change it so it reads as follows:

    DirectoryIndex index.html index.htm index.php
    

    Then append the following lines to the end of the file in order to support PHP files as well as phpMyAdmin, which normally lives outside of the Apache document root. Note: if you elected not to install phpMyAdmin, then you need only add the two AddType lines:

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    
    Alias /phpmyadmin "/usr/local/www/phpMyAdmin"
    
    <Directory "/usr/local/www/phpMyAdmin">
    Options None
    AllowOverride None
    Require all granted
    </Directory>
    

    As an optional step, if you’d like to add multilanguage support to Apache, uncomment the following line:

    Include etc/apache24/extra/httpd-languages.conf
    

    Then open the language settings file /usr/local/etc/apache24/extra/httpd-languages.conf and add the following line to the end of the file:

    AddDefaultCharset On
    

    Now restart Apache:

    /usr/local/etc/rc.d/apache24 restart
    

    That’s it for our Apache configuration. Now let’s configure phpMyAdmin. We’ll do this by creating the file /usr/local/www/phpMyAdmin/config.inc.php, the basic configuration file for phpMyAdmin. Traditionally, users have manually created config.inc.php, but now phpMyAdmin includes a nice setup script, making it much easier to create this file with the settings you want. Start by creating the directory /usr/local/www/phpMyAdmin/config and make it writable by phpMyAdmin:

    mkdir /usr/local/www/phpMyAdmin/config && chmod o+w /usr/local/www/phpMyAdmin/config
    

    Then open your web browser and navigate to http://your-hostname-or-IP-address/phpmyadmin/setup where you will see the phpMyAdmin setup Overview page. Select “New server” and then select the “Authentication” tab. Under the “Authentication type” choose “http” from the drop-down list (using HTTP-Auth to sign-in into phpMyAdmin will avoid storing login/password credentials directly in config.inc.php) and remove “root” from the “User for config auth”(See Figure 1).

    Screenshot of the phpMyAdmin setup page

    Figure 1

    Now select “Save” and you will be returned you to the Overview page where you should see a new server listed. Select “Save” again in the Overview page to save your configuration as /usr/local/www/phpMyAdmin/config/config.inc.php. Now let’s move that file to /usr/local/www/phpMyAdmin where phpMyAdmin can make use of it.

    mv /usr/local/www/phpMyAdmin/config/config.inc.php /usr/local/www/phpMyAdmin	
    

    Now let’s try out phpMyAdmin to make sure it works. Point your web browser to http://your-hostname-or-IP-address/phpmyadmin where you will be presented with a pop-up box requesting you to log in. Use “root” and the MySQL password you set up previously, then you should be directed to the phpMyAdmin administration page. We no longer need the /usr/local/www/phpMyAdmin/config directory so let’s remove it and wrap up by restarting the Apache and MySQL servers:

    rm -r /usr/local/www/phpMyAdmin/config
    /usr/local/etc/rc.d/apache24 restart
    /usr/local/etc/rc.d/mysql-server restart
    

    Testing our installation using WordPress

    WordPress is a full-featured website/blog platform that makes heavy use of Apache, MySQL and PHP. We’ll install it on our newly created implementation to ensure we have these packages installed and working correctly. Once again, all commands are issued as the root user or by simulating the root user using the command su. Let’s start by downloading the latest WordPress directly from the developers site to your home directory and untarring the package:

    fetch http://wordpress.org/latest.tar.gz
    tar -zxvf latest.tar.gz 
    

    You should now see the new directory wordpress in your home directory. Next we need to create the file ~/wordpress/wp-config.php and make some changes to it so WordPress can access the MySQL server. First, let’s copy the file ~/wordpress/wp-config-sample.php to use as a template:

    cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
    

    Open ~/wordpress/wp-config.php in your favorite editor and enter the database name as well as your MySQL login and password in the appropriate lines. When complete, it should look like the following:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');
    
    /** MySQL database username */
    define('DB_USER', 'root');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'your-mysql-password');
    

    Now move the wordpress directory to Apache’s document root:

    mv ~/wordpress/ /usr/local/www/apache24/data/
    

    Next, let’s create an MySQL database for our WordPress installation. Open phpMyAdmin in your browser and create a database by selecting the “Databases” tab at the top. Enter a name for it in the “Create database” field. For purposes of our example, I’ll use “wordpress” as the database name. You’re free to use a different database name, just make sure to use the same name in the define(‘DB_NAME’, ‘your-DB-name’); line in ~/wordpress/wp-config.php as described above. Then select “Create.”

    Now let’s run the WordPress script that will populate its database with the requisite tables. Open your web browser and navigate to http://your-hostname-or-IP-address/wordpress/wp-admin/install.php. If everything is configured correctly you should see the WordPress installation wizard page (See Figure 2). Enter a title for your site, username, password, and an e-mail, then select “Install WordPress.” Then login with your newly created WordPress credentials and you should be presented with the default WordPress administration page.

    Screenshot of WordPress installation page

    Figure 2

    Common problems

    An error that occasionally pops up when attempting to start the Apache server is the following:

    httpd: apr_sockaddr_info_get() failed for <some-host-name>
    httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
    /usr/local/etc/rc.d/apache24: WARNING: failed to start apache24
    

    This can be fixed by adding a line to /etc/hosts. First, verify your hostname by running the hostname command:

    hostname
    

    Then add the following to /etc/hosts:

     
    hostname   IP-address-of-your-freebsd-box
    

    Finally, 403 permission problems seem to frequently pop up when trying to access phpMyAdmin. This is usually caused by errors in the way either the Alias or Directory Apache directives for phpMyAdmin have been written in /usr/local/etc/apache24/httpd.conf. As an example, a missing “/” in the Alias statement cost me two hours of troubleshooting time!

    Conclusion

    Well, that’s it. A few hours of your time with the FreeBSD Ports Collection and you can a get a fully configured “AMP” web development server up and running on your FreeBSD box.

    References

    http://caffetine.org/freebsd-amp.php

    https://httpd.apache.org/docs/2.4/upgrading.html

    Tags: , ,

    83 Responses to “How to Install Apache, MySQL, PHP, and phpMyAdmin on FreeBSD”

    1. junkiest Says:

      Nice tutorial…. thanks !!!

    2. airjure Says:

      Thanks a lot for this tutorial! It helped me a lot. :)

    3. iceflatline Says:

      airjure, you’re welcome. Thanks for the comment.

    4. Jayson Says:

      This is just what I am looking for. It is so much easier with layouts and color code. Thank you.

    5. iceflatline Says:

      Jayson: Thanks for your kind comments.

    6. Johannes Says:

      Great stuff!

      Perfect, best current guide out there, really. thanks a lot!

    7. iceflatline Says:

      Johannes, glad it was helpful. Thanks for the kind words.

    8. DrTebi Says:

      Thank you for the hint on the
      “local file (7229347 bytes) is longer than remote file (5324905 bytes)”
      error.

      That fixed my problem when trying to upgrade Apache.

    9. iceflatline Says:

      DrTebi: Great! Glad it worked.

    10. Jayr Says:

      Excellent tutorial. Worked perfect!

    11. iceflatline Says:

      Jayr, awesome! Thanks for posting your comment.

    12. matt Says:

      Hello,

      Followed your directions but php info document does not work

      My browser just tries to download it. This is FreeBSD9-STABLE with same apache and php you had. Any ideas? Seems like getting php to work on FreeBSd is turned into a huge mess since the 4.x fbsd days!

    13. iceflatline Says:

      matt, hmmm… not sure. I used 9.0-RELEASE for the post. Perhaps there is something in STABLE that has broken compatibility? If I get some time I’ll try to recreate using STABLE.

    14. deine mudder Says:

      thank U sir!

    15. colour Says:

      Everything work perfect accept for the last one WordPress… received below message when I try to open the wp-config.php from web browser
      “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

    16. iceflatline Says:

      colour, I’m unclear on why you are attempting to open wp-config in your browser. Did you try to open http://your-hostname-or-IP-address/wordpress/wp-admin/install.php?

    17. Charles Says:

      This tutorial is excellent. However, I continue to have an issue when attempting to run ‘~/wordpress/wp-admin/install.php’. The error is “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

      The environment is FreeBSD 9.0, Apache 2.2.22, MySQL 5.5.25, PHP 5.4.3, phpMyAdmin 3.5.1, PHP extension: mysqli, and WordPress 3.4.

      I have gone over the php.ini file and uncommented all the necessary lines but the error continues. Everything seems to be functioning properly.

      Suggestions?

      Thank you in advance.

    18. reaper Says:

      I’ve got the same error as Charles above. I’ve gone through the steps above to the letter but I also get a
      “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

    19. iceflatline Says:

      Charles, I’m running the same packages but have not encountered that error. You might try restarting the apache and mysql servers, and then create a phpinfo.php page to see if mysql and mysqli support are indeed present. Finally, you may want to try reinstalling the php5-extensions package without the mysqli support to see if that might be gumming things up for you.

      There should be no further configuration needed to /usr/local/etc/php.ini after successfully copying it from /usr/local/etc/php.ini-development, however, I’ve posted mine to http://pastebin.com/74X4k0MD in case it might be helpful to you.

      Good luck and let me know what you find out.

    20. Darren Says:

      Hiya.

      I’m not sure why my name came out as reaper above, stupid auto-fill.

      I recompiled php5-extensions with both MySQLi and MySQL support. This time I got no error. The only problem now is that I just get a blank page when I browse to my site :(

      No errors in the access log:
      – - [15/Jun/2012:09:57:29 +0100] “GET /ccie/ HTTP/1.1″ 200 -

      So the get is working. No error here. NO 403 or 404 error in my browser either. Just a blank page.

      Any ideas?

    21. iceflatline Says:

      Charles, Darren, I’ve attempted to reinstall everything using the lastest packages and, among other issues, am encountering the same mysql error. I’ll figure out what the issues are and repost when I find a work around. Apologies for the hassles…

    22. Darren Says:

      No worries. I’ve got my site running on my Linux box. I might actually go for an older version of FreeBSD if I find some time

    23. iceflatline Says:

      Okay, reinstalled from scratch this weekend using the most recent packages. This time adding both the mysql and the mysqli options when compiling php5-extensions. WordPress installed without error. It appears there is now a dependency on the older PHP MySQL driver where one did not exist before. Or, more likely, it was selected by default in an earlier port and I failed to notice it and compiled it in, which would explain why subsequent port updates failed to catch anything wrong in my implementation. Anyway, the package list and installation steps in the post have been updated. My thanks to Charles and Daren for bringing the problem to light.

    24. Charles Says:

      I haven’t been able to address the issue since last week. I’ll reinstall as well and add both mysql/msqli.

      Sounds like that may be the issue.

      Thanks.

    25. Charles Says:

      Just finished re-installing from scratch. Once I added the mysql and mysqli options the install went flawlessly.

      Thanks for the great tutorial and the assistance with the dependency issue.

    26. iceflatline Says:

      Charles, thanks for taking the time to verify, and apologies again for the hassle.

    27. ronjns Says:

      Thank you very much!

    28. iceflatline Says:

      ronjns, you’re welcome. Thanks for the comment.

    29. Abay Says:

      Excelente tutorial, muy completo, enhorabuena.

      Saludos.

    30. Gerald Says:

      I’ve been trying to get this to work and I get stuck on the phpmyadmin stuff – I point a browser at it and I get an unprocessed php file sent from the server. There were also a couple dependencies that wouldn’t compile right, but I was able to pkg_add them.

      Thanks for the guide though. :) Any chance of a less compiling “pkg_add -r” solution?

    31. iceflatline Says:

      Gerald, sorry to hear about your difficulties compiling the requisite ports. Glad you got it working though. I typically don’t use pre-compiled binary packages on *bsd so unlikely I’ll write an article explaining their use in this application. You never know though…

    32. Gerald Says:

      And no… pkg_add isn’t doable due to default compile time options not building the right bits. Furthermore mixing pkg_add and compiled ports stuff confuses dependencies in both systems – eventually making stuff refuse to work. :p

      What broke me is that I had already installed some other utils using pkg_add, and it broke the compile time dependency checks in the ports builds. I’ve regressed my pkg_add chain and am now doing ports builds for those utils as well.

    33. iceflatline Says:

      Gerald, good advice. Thanks for sharing it.

    34. Gerald Says:

      You’re welcome. Thank you for the starting point.

      For the details of the problems I encountered (and my mistakes) – one of the php5 dependencies didn’t want to build because it conflicted with a conf package that pkg_add had installed to support mc (midnight commander). So I simply did “pkg_add -r php5″, everything looked okay… except the precompiled package doesn’t include the apache module. D’oh.

      So, to clean up the mess – pkg_deleted the conflicting package, and everything stacked on top of it (mc, php5), including the stuff that stacked on when it was compiled (php5-extensions, phpmyadmin.) Now compiling everything over again. I’ll rebuild mc after I have AMP running.

      Something I did different – the 11 lines of support for php became /usr/local/etc/apache22/Includes/php5.conf on my setup because apache autoloads all .conf files in that directory. Keeps httpd.conf just a little cleaner.

      Anyway, experience shared, lessons learned. Thank you again for the basic guide. :)

    35. Graeme Geldenhuys Says:

      Thank you VERY MUCH for this great article. It was exactly what I was looking for, and your instructions were clear and spot on! I had to laugh today, when I read your “Common Problems” section this morning – after I spend an hour last night trying to get the phpMyAdmin to work. I too had the missing “/” in my Apache config files. :-) That will teach me for not reading the setup instructions completely, before I start the setup.

    36. iceflatline Says:

      Graeme, You’re quite welcome. Don’t feel too bad, I’ve actually tripped over this problem twice! That will teach me for not reading my own setup instructions.

    37. blueigloo Says:

      I can’t tell you how much this helped me. Even though I ran into extra snags since I’m trying to install these programs in a FreeNAS Jail, I still don’t think I would have come close to being successful without this guide. Thank you, thank you, and thank you.

    38. iceflatline Says:

      Blueigloo, You’re very welcome. I’m glad it helped. I’ve not tried to stand this up in FreeNAS before; however, I have used FreeNAS for simply storing the Apache doc root. I also recently switched from FreeNAS to NAS4Free and like it much better.

      Cheers.

    39. Somsak Says:

      Hi, Anybody can help Pls.
      After Follow >> mv /usr/local/www/phpMyAdmin/config/config.inc.php /usr/local/www/phpMyAdmin and will try again then not show anything

      Help me ple.
      Somsak

    40. iceflatline Says:

      Somsak, thanks for posting and apologies for the delay in responding. I just ran through the steps on a new FreeBSD 9 RELEASE system and was able to install everything with no issues. About the only thing I can suggest at this point is to carefully run back through the steps and post again if you need clarification on any of them.

    41. ahmadsarang Says:

      i have problem regarding this
      can someone help me??

      stop in /usr/ports/archivers/php5-zip

      this happen i try to built phpmadmin ports

    42. iceflatline Says:

      ahmadsarang, I assume your trying to install PHP5? I just installed AMP per the instructions above on a fresh install of FreeBSD 9-RELEASE and encountered no such error. Does the stop message give any other indication of what the problem might be?

      You might also try installing portmaster (/usr/ports/ports-mgmt/portmaster) and try installing PHP5 using it:

      portmaster -dwv lang/php5
      
    43. chaoman Says:

      Thanks a lot for this nice tutorial. It helps me to integrate newly created jail on nas4free with a webserver.

    44. iceflatline Says:

      chaoman, you’re very welcome. Thanks for the kind words.

    45. 在 NAS4Free 的 jail 上安裝 Apache, PHP 和 MySQL | www.chaoman.com 炒麵的嘀咕自語 Says:

      [...] http://www.iceflatline.com/2011/11/how-to-install-apache-mysql-php-and-phpmyadmin-on-freebsd/ [...]

    46. XenitXTD Says:

      Hey, I run the process and everything goes perfectly until i get to the part where i create the config folder in the phpMyAdmin and am supposed to run the setup from hostname/phpMyAdmin/Setup and i get a 404 not found… could you advise as to why this is

    47. XenitXTD Says:

      Just and Update, My Apache page shows IT works and all and everything works like perfectly but the part where i am supposed to Setup the PHP MY ADMIN is not working… I did the install twice to the exact specifications listed and found that its the same for me… what am i doing wrong, other than the My Admin excellent Article and Thanks for the help…

    48. XenitXTD Says:

      Hi I found that i am logged in with the Root account and when i try to access the PhpMyAdmin/Config folder which i created with the mkdir like explained and adding the CHMOD o+w it i am unable to access it as it says that my root account his permission denied

      When i open the url to the setup its a 404 url not found on server…what else can i do to grant access to the folder

    49. iceflatline Says:

      XenitXTD, in my experience that problem is usually caused by errors in the way either the Alias or Directory Apache directives for phpMyAdmin have been written in /usr/local/etc/apache22/httpd.conf. Make sure they are entered as follows, including character case:

      Alias /phpmyadmin "/usr/local/www/phpMyAdmin"
      
      <Directory "/usr/local/www/phpMyAdmin">
      Options None
      AllowOverride None
      Order allow,deny
      Allow from all
      </Directory>
      
    50. Romnick Says:

      nice how to, ur da best :)

    51. novice Says:

      Hi,
      Excellent tutorial, easy to follow and brief where it should be.

      I’ve only just completed my first ever freebsd install (release 9.1 in a vm) and almost everything has worked as per your tutorial.

      One problem I have had though, came right at the end, where wordpress was expecting the wp-login.php script to reside within a “wp-admin” folder within wordpress [http:///wordpress//wp-login.php] whereas, my install of wordpress seems to have it in the root directory (wordpress/).

      I manually altered the url, the script worked and logged me into the site, but I wonder whether I should create the “wp-admin” folder within wordpress or maybe look to find the line inside wordpress/index.php and change that to wordpress/wp-login.php rather than wordpress/wp-admin/wp-login.php.

      I’m not sure why this is different, I don’t think I’ve deviated in any meaningful way from the tutorial…

      The one significant difference might be that I originally installed release 9.0 of freebsd, then let the system upgrade overnight to 9.1.

      Anyway, some advice and maybe pointers to a solution would be much appreciated.

      Thanks, and thanks again for a great tutorial.

    52. novice Says:

      re: my previous post. The wordpress url should read http://my.ip.address/wordpress/wp-admin/wp-login.php*

    53. iceflatline Says:

      novice, thanks for your comment. In a default installation of WordPress the file wp-login.php should reside in the root directory. This is where WordPress expects it to be. This configuration then allows you to log in using the following URL syntax: [site]/wp-admin or [site]/wp-login.php .

    54. Ranzabar Says:

      Sa-weeet. Did the job. Now I can sleep at night again.

    55. iceflatline Says:

      Ranzabar, awesome! Glad I was able to help you (hopefully) get a good night of sleep.

    56. renic Says:

      You should really suggest “make config-recursive” instead of “make config” … this usually prevents coming back to find a config screen when you are expecting to find a command prompt :)

    57. Tykog Says:

      been trying to setup this exact configuration for a few days with errors, in the latest FreeBSD available as of 3/23/13 there are issues with “libgpg-error-1.11.tar.bz2″ and “libgcrypt-1.5.0.tar.bz2″ you can manually fetch them from
      ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.11.tar.bz2
      and here
      ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2
      and put them into /usr/ports/distfiles

      also some issues when installing phpMyAdmin, problems with openjdk6, just find it in
      /usr/ports/java/openjdk6
      then
      make install clean
      then return to phpMyAdmin and follow instructions as provided here.

    58. iceflatline Says:

      Tykog, you are referring to the first beta build of FreeBSD 8.4, in the project’s “legacy” branch, announced 20130323. My post was based on the latest production release of FreeBSD – 9.1-RELEASE. In short, I’m not surprised you ran into some dependency issues. Regarding phpmyadmin, your comment suggests it has a dependency on java, however there is no such dependency. Perhaps though, something else you’re doing requires you to install it…

    59. recycled Says:

      Like Tykog I had issues installing phpMyAdmin.

      I’m running FreeBSD 9.1-RELEASE 64-bit as a virtual machine on XenServer 6.1 with the kernel custom configured with:
      options IPFILTER
      options IPFILTER_LOG
      Following your tutorial step-by-step resulted in errors with openjdk6 which were rectified by entering /usr/ports/java/openjdk6/ and running a make install clean
      After that, I returned to /usr/ports/databases/phpmyadmin/ and finished the process.

    60. iceflatline Says:

      recycled, hmmm, strange. I just performed the steps outlined in the post on a fresh install of 9.1-RELEASE (on bare metal) after updating it using freebsd-update. I encountered no such dependency for openjdk6. Running make build-depends-list && make run-depends-list also confirms that it is not a dependency.

    61. ysq Says:

      nice tutorial, tks.

    62. Chris Says:

      AllowOveride should be All or at least AuthConfig
      if we want to secure the phpMyAdmin installation with password.
      (In case the box is public or has static IP)

      By the way, I used suPHP from www/suphp port.
      Only one extra step to secure it and make it run under suphp
      addind
      suPHP_Engine on
      in httpd.conf.

      Just writing it here in case someone lands from google. Both useful.

    63. RandomYggdrasil Says:

      Had a lot of issues trying to get this to work but then I deinstalled apache 2.2 and used apache 2.4 replacing the appropriate lines with apache24.

      Not sure if anyone will read the comments this far down but hope it helps.

    64. Yu Says:

      Just want to thank you for your detail tutorial which helps me a lot

    65. SteveS Says:

      Great article… but I hit a snap with myphpadmin:

      I got the 403 permission error until I changed my httpd.conf setting (Apache24) to read:

      Options None
      AllowOverride None
      Order allow,deny
      Allow from all
      Require all granted

      Apparently, “Required all granted” for this section enables access.

    66. iceflatline Says:

      SteveS, thanks very much for bringing this problem to my attention. Yes, it appears that as of Apache 2.4, the old access control directives no longer work, and must be replaced by the new Require directive, implemented under the new Apache module mod_authz_host. I’ve revised the post to correct this issue.

    67. Instalar Apache, MySQL, PHP, phpMyAdmin y Wordpress en FreeBSD | Cyberia Lab Says:

      […] http://www.iceflatline.com/ http://caffetine.org/ […]

    68. Clay Garland Says:

      You should add, that if people are getting gmake not found errors when they’re trying to make install, that they need to create a symlink to gmake in their usr/bin directory. I always have this problem when I’m setting up BSD on a virtual machine.

    69. iceflatline Says:

      Clay, I think you just did. Thanks for adding your knowledge to the discussion.

    70. Icarus Says:

      This is a great help took me a few hours of keeping the shell open installing the packages and watching a movie at same time,but worked perfectly there is mysql 5.6 out now but i kept with 5.5 this guide works perfectly this is a big help for a raw freebsd install like i had,now i also have a fully functional web and datbase server FAMP
      il keep up with your blog

      Thank You !!!

    71. iceflatline Says:

      Icarus, awesome. Glad it worked well for you. Thanks for the kind words.

    72. Harry Says:

      Nice with this tutorial to get WordPress up and running locally… just working “out of the box” on my FreeBSD 10.0-BETA3.

      Cheers,
      Harry

    73. iceflatline Says:

      Harry, thanks for the kind words. Glad to hear it worked on FreeBSD 10. I have not had a chance to test it yet.

    74. JakDaRippa Says:

      Thanks. Very accurate. The best AMP tutorial I’ve seen so far.

    75. iceflatline Says:

      JakDaRippa, thanks very much for the kind words.

    76. amen Says:

      Hi this work on freenas 9.2 do i need to create a jail? or just ssh to freenas and start copy paste this steps?

    77. iceflatline Says:

      amen, assuming you have access to ports (and can build them) on FreeNAS I see no reason why it should not work. As an alternative, you might look to see if there is a FreeNAS “plugin” that supports this fucntionality. If you just want to use FreeNAS as the Apache doc root, I wrote a post on how to do this.

    78. FreeNAS User Says:

      Thanks for taking the time to write this up iceflatline. I’ve used it twice to setup two separate servers.

      Very well written.

      Cheers!

    79. iceflatline Says:

      FreeNAS User, thanks for the kind words.

    80. techknight Says:

      Is there anyway to separate the configuration into a couple of Jails. I am relatively new to FreeBSD, but am learning as much as i can when i can. I am planning to have multiple Jails with Apache and PHP and would like to have one Jail with MySQL in it versus having MySQL in every Jail. Is it even possible to begin with? And if it is are there any special steps that need to be taken?

      Your tutorial here is very good and i have learned a lot from it.

      Thank You

    81. iceflatline Says:

      techknight, thanks for the kind words. I have not implemented this in jails the way you’ve suggested but I see no reason why it wouldn’t work. PHP would likely have to live within each jail along with Apache, but then it seems like you could simply point each web server to the jail where the database lives.

      Give it try and let me know how you make out.

    82. Chris Says:

      FYI, lang/php5 doesn’t have an option to build the apache module anymore. You have go to www/mod_php5 and “make clean install” after doing the same for lang/php5

      Restart apache afterwards and you should be good to go.

    83. iceflatline Says:

      Chris, thanks for the update. I’ll revise the post as soon as I can.

    Leave a Reply