<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mysql Archives | WebCodingStudio</title>
	<atom:link href="https://webcodingstudio.com/blog/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>https://webcodingstudio.com/blog/tag/mysql</link>
	<description></description>
	<lastBuildDate>Tue, 23 Jun 2015 08:57:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.14</generator>

<image>
	<url>https://webcodingstudio.com/wp-content/uploads/2020/04/cropped-favicon-32x32.png</url>
	<title>Mysql Archives | WebCodingStudio</title>
	<link>https://webcodingstudio.com/blog/tag/mysql</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>FreeBSD 9.2 server configuration: Apache, Php, Mysql, DNS, Samba</title>
		<link>https://webcodingstudio.com/blog/freebsd-92-server-configuration-apache-php-mysql-dns-samba</link>
					<comments>https://webcodingstudio.com/blog/freebsd-92-server-configuration-apache-php-mysql-dns-samba#comments</comments>
		
		<dc:creator><![CDATA[Evgeny Matsakov]]></dc:creator>
		<pubDate>Tue, 18 Feb 2014 13:54:49 +0000</pubDate>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Samba]]></category>
		<guid isPermaLink="false">https://webcodingstudio.com/?p=316</guid>

					<description><![CDATA[<p>
  Hello everyone!
  </p>
<p>
  Once, somewhere in summer 2011, I already configured FreeBSD 8 development server in our office. Then upgraded it to FreeBSD 9.0<br />
  And now new 2x2Tb disks ( for RAID0 ) and 1 SSD 100Gb arrived in case we have a lack of space on the current 500GB raid.
 </p>
<p>The post <a href="https://webcodingstudio.com/blog/freebsd-92-server-configuration-apache-php-mysql-dns-samba">FreeBSD 9.2 server configuration: Apache, Php, Mysql, DNS, Samba</a> appeared first on <a href="https://webcodingstudio.com">WebCodingStudio</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello everyone!</p>
<p>Once, somewhere in summer 2011, I already configured FreeBSD 8 development server in our office. Then upgraded it to FreeBSD 9.0</p>
<p>And now new 2x2Tb disks ( for RAID0 ) and 1 SSD 100Gb arrived in case we have a lack of space on the current 500GB raid.</p>
<p>It&#8217;s time to install it again!</p>
<p>Main goal is to have more flexible server configuration and avoid of small errors which i had in first installation.</p>
<p><!--break--></p>
<p>The main steps would be:</p>
<ul>
<li>FreeBSD 9.2-RELEASE installation</li>
<li>Configuration and installation small utils like MC, Webmin, etc</li>
<li>Apache 2.2 installation</li>
<li>PHP 5.2, PHP 5.3, PHP 5.4 installation. All versions would be installed as FCGI</li>
<li>Mysql server</li>
<li>BIND DNS server</li>
<li>Apache Virtual Hosts</li>
<li>Samba 3.6</li>
<li>Sendmail</li>
</ul>
<h2>1. FreeBSD 9.2-RELEASE installation</h2>
<p>Diring the installation please refer this official manual: http://www.freebsd.org/doc/handbook/bsdinstall.html<br />
Allocating Disk Space: http://www.freebsd.org/doc/handbook/bsdinstall-partitioning.html</p>
<h2>2. Configuration and installation small utils like MC, Webmin, etc</h2>
<p>2.1 Add &#8220;admin&#8221; user to the &#8220;wheel&#8221; group.<br />
Login as the root user and add &#8220;admin&#8221; user to the &#8220;wheel&#8221; group. Then you will be able to operate as superuser.</p>
<pre>  pw user mod admin -G wheel
</pre>
<h3>2.1 MC</h3>
<pre>  cd /usr/ports/misc/mc
  make install clean
</pre>
<p>Uncheck &#8220;X11&#8221; support. All others may leave by default. MC installations is a really long process with a lot of dialog windows. Just press everywhere &#8220;Ok&#8221;.</p>
<h3>2.2 Webmin</h3>
<p>Install or update ports</p>
<pre>  portsnap fetch
  portsnap extract
  portsnap fetch update
</pre>
<p>Webmin installation</p>
<pre>  cd /usr/ports/sysutils/webmin
  make install clean
</pre>
<p>Add next line to &#8220;/etc/rc.conf&#8221; file.</p>
<pre>  webmin_enable="YES"
</pre>
<p>Configure Webmin by running.</p>
<pre>  /usr/local/lib/webmin/setup.sh
</pre>
<p>Start Webmin for the first time by running</p>
<pre>  /usr/local/etc/rc.d/webmin start
</pre>
<p>Open Webmin in browser</p>
<pre>  https://your-ip:10000/
</pre>
<h2>3. Apache 2.2 installation</h2>
<p>Navigate to the Apache server port and build it:</p>
<pre>  cd /usr/ports/www/apache24
  make install clean
</pre>
<p>Add next line to &#8220;/etc/rc.conf&#8221; file.</p>
<pre>  apache24_enable="YES"
</pre>
<p>Now let&#8217;s start Apache to make sure it works:</p>
<pre>  /usr/local/etc/rc.d/apache24 start
</pre>
<p>If you are getting this error</p>
<pre>  Could not reliably determine the server's fully qualified domain name, 
  using 127.0.0.1. Set the 'ServerName' directive globally to suppress 
  this message
</pre>
<p>Add next line to /usr/local/ect/apache24/httpd.conf file</p>
<pre>  ServerName localhost
</pre>
<h2>4. PHP 5.2, PHP 5.3, PHP 5.4 installation. All versions as FCGI</h2>
<p>Install mod_fcgid</p>
<pre>  cd /usr/ports/www/mod_fcgid
  make install clean
</pre>
<p>Add next line to /usr/local/ect/apache24/httpd.conf file</p>
<pre>  LoadModule fcgid_module libexec/apache24/mod_fcgid.so
</pre>
<h3>4.1 Installing PHP5.4</h3>
<pre>  cd /usr/ports/lang/php5
  make config
  make PREFIX=/usr/local/php54 PHPBASE=/usr/local/php54 install clean
</pre>
<p>If you got this error</p>
<pre>  error: xml2-config not found. Please check your libxml2 installation.
</pre>
<p>Try this:</p>
<pre>  cd /usr/ports/textproc/libxml2/
  make reinstall
</pre>
<p>Pre configure PHP54 to make sure it works.<br />
Add next lines to to /usr/local/ect/apache24/httpd.conf file.</p>
<pre>  &lt;Directory "/usr/local/www/apache24/data"&gt;
    ...
    Options ExecCGI
    Options +Indexes
    Allow from all
  &lt;/Directory&gt;
  
  &lt;IfModule mime_module&gt;
    ...
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  &lt;/IfModule&gt;
</pre>
<p>Create new file /usr/local/ect/apache24/Includes/httpd-fcgid.conf with the next content:</p>
<pre>  &lt;IfModule mod_fcgid.c&gt;
    AddHandler fcgid-script .php
    FCGIWrapper /usr/local/php54/bin/php-cgi .php
    FcgidMaxRequestLen 134217728
  &lt;/IfModule&gt;
</pre>
<p>Change DirectoryIndex directive in file /usr/local/etc/apache24/httpd.conf</p>
<pre>  DirectoryIndex index.html index.htm index.php
</pre>
<h3>4.2 Installing PHP5.3</h3>
<pre>  cd /usr/ports/lang/php53
  make config
  make PREFIX=/usr/local/php53 PHPBASE=/usr/local/php53 install clean DISABLE_CONFLICTS=1
</pre>
<h3>4.3 Installing PHP5.2</h3>
<pre>  cd /usr/ports/lang/php52
  make config
  make PREFIX=/usr/local/php52 PHPBASE=/usr/local/php52 install clean
</pre>
<h3>4.4 Configuration all PHP5.X</h3>
<p>Create php.ini file for each php verson: /usr/local/php5X/etc/php.ini</p>
<pre>  user_ini.filename = "php.ini"
  date.timezone = Europe/Kiev
</pre>
<p>In this way you can override php_value and php_flag variables, because PHP installation as FCGI doesn&#8217;t allow to override these variables via htaccess ( cause 500 error ).<br />
You can override php_value and php_flag per-directory level, just need to create php.ini in the directory where you want to override these variables.<br />
P.S. user_ini.filename is not supported by PHP52, so you have to override these variables in the main php.ini file /usr/local/php52/etc/php.ini</p>
<p>date.timezone needed to avoid following Warning</p>
<pre>  Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings.
</pre>
<p>For using another FCGI Wrapper instead of default php54, just add into htaccess:</p>
<p>For php53</p>
<pre>  FCGIWrapper /usr/local/php53/bin/php-cgi .php
</pre>
<p>For php52</p>
<pre> 
  FCGIWrapper /usr/local/php52/bin/php-cgi .php
</pre>
<h3>4.5 Installing PHP5.4 extensions</h3>
<pre>  cd /usr/ports/lang/php5-extensions
  make PREFIX=/usr/local/php54 PHPBASE=/usr/local/php54 install clean
</pre>
<p>Select neccessary extensions which you need to have.</p>
<p>If you got this error</p>
<pre>  error: Please reinstall the libcurl distribution
</pre>
<p>Try this:</p>
<pre>  cd /usr/ports/ftp/curl
  make reinstall
</pre>
<p>If you got this error</p>
<pre>    Stop in /usr/ports/x11/libXau.
</pre>
<p>put the following in your /etc/make.conf:</p>
<pre>  WITHOUT_X11=yes
</pre>
<p><strong>For each failed extension, try</strong></p>
<pre>  cd /usr/ports/[portdir]
  make deinstall
  make clean
  make distclean
  make clean
  make rmconfig
</pre>
<p><strong>And Then resintall it (with PREFIX if needed)</strong></p>
<p>Reinstall libjpeg</p>
<pre>  cd /usr/ports/graphics/jpeg
  make reinstall
</pre>
<p>Reinstall freetype2</p>
<pre>  cd /usr/ports/print/freetype2
  make reinstall
</pre>
<h3>4.6 Installing PHP5.3 extensions</h3>
<pre>  cd /usr/ports/lang/php53-extensions
  make PREFIX=/usr/local/php53 PHPBASE=/usr/local/php53 install clean
</pre>
<p>Select neccessary extensions which you need to have.</p>
<h3>4.7 Installing PHP5.2 extensions</h3>
<pre>  cd /usr/ports/lang/php52-extensions
  make PREFIX=/usr/local/php52 PHPBASE=/usr/local/php52 install clean
</pre>
<p>Select neccessary extensions which you need to have.</p>
<p><strong><br />
Please be sure you have instaled all these extensions for all PHP versions<br />
CURL, GD, MYSQL, MYSQLI, PDO, PDO_MYSQL, MBSTRING, MCRYPT, ZLIB, ZIP, SOAP, LDAP, OPENSSL<br />
</strong></p>
<h2>5. Mysql Server</h2>
<p>Build the MySQL server:</p>
<pre>  cd /usr/ports/databases/mysql56-server
  make install clean
</pre>
<p>Add the following line to /etc/rc.conf:</p>
<pre>  mysql_enable="YES"
</pre>
<p>Start the mysql server:</p>
<pre>  /usr/local/etc/rc.d/mysql-server start
</pre>
<p>Then set a password for the MySQL root user:</p>
<pre>  /usr/local/bin/mysqladmin -u root password 'your-password'
</pre>
<p>Add new user within the MySQL shell:</p>
<pre>  CREATE USER 'developer'@'localhost' IDENTIFIED BY 'developer';
  GRANT ALL PRIVILEGES ON * . * TO 'developer'@'localhost';
  FLUSH PRIVILEGES;
</pre>
<h2>6. BIND DNS server</h2>
<p>Usually BIND server is already installed in FreeBSD.<br />
Add the following line to /etc/rc.conf:</p>
<pre>  named_enable="YES"
</pre>
<p>In the file /etc/namedb/named.conf make next configurations</p>
<pre>  options {
    ...
    listen-on  {
      192.168.1.200;
      127.0.0.1;
    };
    ...
  };
  
  zone "dev" {
    type master;
    file "/etc/namedb/dev.zone";
  };
  zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/namedb/dev-reverse.zone";
  };
</pre>
<p>Then create zone file /etc/namedb/dev.zone</p>
<pre>  dev.  IN  SOA ns1.dev. n2.dev. (
        2009121101
        86400
        7200
        8640000
        86400 )

        IN  NS  ns1.dev.

  ns1 IN  A 192.168.1.200
  ns2 IN  A 192.168.1.200

  vmserver  IN  A 192.168.1.200
  php54 IN  A 192.168.1.200
</pre>
<p>And for reverse zone /etc/namedb/dev-reverse.zone</p>
<pre>  $TTL  3600
  @ IN  SOA ns1.dev. ns2.dev. (
        2009121102
        3600
        900
        3600000
        3600 )
  IN  NS  ns1.dev.
  IN  NS  ns2.dev.

  200 IN  PTR vmserver.dev.
  200 IN  PTR php54.dev.
</pre>
<p>At last configure /etc/resolv.conf properly</p>
<pre>  domain dev
  nameserver 192.168.1.200
</pre>
<h2>7. Apache Virtual Hosts</h2>
<p>Create /usr/local/ect/apache24/Includes/httpd-vhosts.conf</p>
<pre>  &lt;VirtualHost *:80&gt;
  DocumentRoot "/usr/local/www/apache24/data"
  ServerName vmserver.dev
  &lt;Directory "/usr/local/www/apache24/data"&gt;
    Require all granted
    Allow from all
  &lt;/Directory&gt;
  &lt;/VirtualHost&gt;

  &lt;VirtualHost *:80&gt;
  DocumentRoot "/usr/local/www/php54.dev"
  ServerName php54.dev
  &lt;Directory "/usr/local/www/php54.dev"&gt;
    Require all granted
    Allow from all
  &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
</pre>
<h2>8. Samba 3.6</h2>
<p>Installation</p>
<pre>  cd /usr/ports/net/samba36
  make install clean
</pre>
<p>Select: ACL_SUPPORT, AIO_SUPPORT, CUPS</p>
<p>Add the following line to /etc/rc.conf:</p>
<pre>  samba_enable="YES"
</pre>
<p>Configuration file /usr/local/etc/smb.conf should contain next lines</p>
<pre>  [global]
    workgroup = WEBCODING
    netbios name = VMSERVER
    server string = Virtual machine server
    security = SHARE

  [work]
    path = /usr/local/work
    public = yes
    browseable = yes
    writable = yes
  [www]
    path = /usr/local/www
    public = yes
    browseable = yes
    writable = yes
</pre>
<h2>9. Sendmail</h2>
<p>At the end, we need to to redirect all email to one on the local email boxes.</p>
<p>We need to create working macro configuration file.</p>
<pre>  cd /etc/mail
  make
</pre>
<p>Add next line to the created sendmail configuration file: /etc/mail/vmserver.dev.mc</p>
<pre>  define(`SMART_HOST',`local:catch-all')
</pre>
<p>Then add alias to the /etc/mail/aliases file</p>
<pre>  catch-all:  qa
</pre>
<p>Generate the sendmail.cf by issuing the following commands:</p>
<pre>  make install
</pre>
<p>And then restart sendmail service</p>
<pre>  make restart
  service sendmail restart
</pre>
<p>Then all emails will be sent to the local mailbox of the QA user instead of spamming real clients mailboxes.</p>
<p>Finished! Now you can use server for development.</p>
<p>P.S. Please don&#8217;t use this configuration on the production servers.</p>
<p>The post <a href="https://webcodingstudio.com/blog/freebsd-92-server-configuration-apache-php-mysql-dns-samba">FreeBSD 9.2 server configuration: Apache, Php, Mysql, DNS, Samba</a> appeared first on <a href="https://webcodingstudio.com">WebCodingStudio</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://webcodingstudio.com/blog/freebsd-92-server-configuration-apache-php-mysql-dns-samba/feed</wfw:commentRss>
			<slash:comments>281</slash:comments>
		
		
			</item>
	</channel>
</rss>
