<?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>El Paso, TX, iPad and iPhone Development, Android Development, and Mobile Web Design and Development &#187; Tech Tips</title>
	<atom:link href="http://phidevinc.com/category/tech-tips/feed" rel="self" type="application/rss+xml" />
	<link>http://phidevinc.com</link>
	<description>iPhone App Development and Mobile Web Design and Development Experts</description>
	<lastBuildDate>Wed, 18 Apr 2012 15:29:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Recompiling PHP5 on Snow Leopard with MySQLi support, and other things</title>
		<link>http://phidevinc.com/recompiling-php5-in-snow-leopard-with-mysqli-support-and-other-things/tech-tips</link>
		<comments>http://phidevinc.com/recompiling-php5-in-snow-leopard-with-mysqli-support-and-other-things/tech-tips#comments</comments>
		<pubDate>Mon, 15 Mar 2010 04:51:54 +0000</pubDate>
		<dc:creator>Ares</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[compiling]]></category>
		<category><![CDATA[mysqli]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[snow leopard]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.phidevinc.com/?p=446</guid>
		<description><![CDATA[[update 04.05.2010. If you got the OS X 10.6.3 update you may find yourself reading this again since it overwrites your php library. Yes, we found out the hard way. Backup your library first. ] We just got a new &#8230; <a href="http://phidevinc.com/recompiling-php5-in-snow-leopard-with-mysqli-support-and-other-things/tech-tips">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #aa0000;">[<strong>update 04.05.2010.</strong> If you got the OS X 10.6.3 update you may find yourself reading this again since it overwrites your php library. Yes, we found out the hard way. Backup your library first. ]</span></p>
<p>We just got a new workstation in the office. After getting it out of the box we were happy to realize that it already comes with a much better configuration for php 5.3 than the old 5.2 of OS X Leopard. Leopard only came with a very few and basic configuration and libraries, that were only fit to new web designer. Apparently they noticed this at Apple and this new version comes with a much better library set.<span id="more-446"></span></p>
<p>In general we have more than once person developing a site. So we use mysql databases that are hosted in a server that anyone can access, that way when someone makes a change to the databases it is immediately propagated to all developers, since we use something similar to a &#8220;networked drive.&#8221;</p>
<p>However, MySQL is still not included, but the folks at mysql have created a dmg that allows you to easily install mysql into your computer. You just need to download it, double click, and follow the prompt. The problem is that php comes with a strange version of mysqli. We were all exited and ready to go when:</p>
<p>Warning: mysqli::mysqli() [mysqli.mysqli] OK packet 6 bytes shorter than expected in /path/to/file on line&#8230;</p>
<div id="attachment_462" class="wp-caption alignright" style="width: 310px"><a href="http://www.phidevinc.com/media/2010/03/Screen-shot-2010-02-23-at-1.20.27-PM.png" rel="images"><img class="size-medium wp-image-462  " title="mysqlidev?" src="http://www.phidevinc.com/media/2010/03/Screen-shot-2010-02-23-at-1.20.27-PM-300x154.png" alt="" width="300" height="154" /></a><p class="wp-caption-text">mysqlidev won&#39;t let you connect to remote servers</p></div>
<p>This happens because the mysqli API library that php is using is the one that comes by default, not the one from the mysql version we just installed. Shoots, we need to recompile, and since we are at it, we will also recomplile with the new version of jpeglib.</p>
<p>Now it makes sense just to grab the configure options shown by phpinfo, but for some reason it references some locations that do not exists for jpeglib and libpng. So we will need to compile those too. Also make sure to remove your dir path from pcre otherwise it will also trow you and error.</p>
<p>Okay, let&#8217;s do this. First we download our source for <a href="http://www.php.net">PHP</a>, <a href="http://www.ijg.org/">LibJPEG</a>, <a href="http://www.libpng.org/pub/png/libpng.html">LibPNG</a></p>
<p>Lets compile libjpeg first: Once you have uncompressed the source, just go into the directory and type in the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MACOSX_DEPLOYMENT_TARGET</span>=<span style="color: #000000;">10.6</span>
&nbsp;
<span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-shared</span></pre></div></div>

<p>That should finish without problems, now go to your libpng folder and type the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-shared</span></pre></div></div>

<p>Again, it should finish without problems. Do the same for libPNG, and</p>
<p>Now, it would make sense to compile php now, but there are some know bugs in php when compiling on a mac so lets get those corrected first, before we continue.</p>
<p>Fist you will need to modify the file <strong>ext/gd/libgd/gd_png.c</strong>, so open it with your favorite text editor and look for the following string:<br />
<code><br />
</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>png_check_sig <span style="color: #009900;">&#40;</span>sig<span style="color: #339933;">,</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #808080; font-style: italic;">/* bad signature */</span></pre></div></div>

<p>&nbsp;</p>
<p>and replace it for this other line:<br />
<code><br />
</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>png_sig_cmp <span style="color: #009900;">&#40;</span>sig<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #808080; font-style: italic;">/* bad signature */</span></pre></div></div>

<p>&nbsp;</p>
<p>Now, using your favorite text editor go to the following file within your php source code <strong>ext/libiconv/libiconv.c</strong><br />
and look for<br />
<code><br />
</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#ifdef HAVE_LIBICONV</span>
<span style="color: #339933;">#define iconv libiconv</span>
<span style="color: #339933;">#endif</span></pre></div></div>

<p>&nbsp;</p>
<p>and replace the libconv of the second line for just iconv</p>
<p>Okay, now we are ready to compile php, so go to the the root of your php source code and type in (copy &amp; paste) the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">CGLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-arch x86_64 -Os -pipe -m64&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #ff0000;">'--prefix=/usr'</span> <span style="color: #ff0000;">'--mandir=/usr/share/man'</span> <span style="color: #ff0000;">'--infodir=/usr/share/info'</span> <span style="color: #ff0000;">'--disable-dependency-tracking'</span> <span style="color: #ff0000;">'--sysconfdir=/private/etc'</span> <span style="color: #ff0000;">'--with-apxs2=/usr/sbin/apxs'</span> <span style="color: #ff0000;">'--enable-cli'</span> <span style="color: #ff0000;">'--with-config-file-path=/etc'</span> <span style="color: #ff0000;">'--with-libxml-dir=/usr'</span> <span style="color: #ff0000;">'--with-openssl=/usr'</span> <span style="color: #ff0000;">'--with-kerberos=/usr'</span> <span style="color: #ff0000;">'--with-zlib=/usr'</span> <span style="color: #ff0000;">'--enable-bcmath'</span> <span style="color: #ff0000;">'--with-bz2=/usr'</span> <span style="color: #ff0000;">'--enable-calendar'</span> <span style="color: #ff0000;">'--with-curl=/usr'</span> <span style="color: #ff0000;">'--enable-exif'</span> <span style="color: #ff0000;">'--enable-ftp'</span> <span style="color: #ff0000;">'--with-gd'</span> <span style="color: #ff0000;">'--with-jpeg-dir=/user/local'</span> <span style="color: #ff0000;">'--with-png-dir=/usr/local'</span> <span style="color: #ff0000;">'--enable-gd-native-ttf'</span> <span style="color: #ff0000;">'--with-ldap=/usr'</span> <span style="color: #ff0000;">'--with-ldap-sasl=/usr'</span> <span style="color: #ff0000;">'--enable-mbstring'</span> <span style="color: #ff0000;">'--enable-mbregex'</span> <span style="color: #ff0000;">'--with-mysql=mysqlnd'</span> <span style="color: #ff0000;">'--with-mysqli=/usr/local/mysql/bin/mysql_config'</span> <span style="color: #ff0000;">'--with-pdo-mysql=mysqlnd'</span> <span style="color: #ff0000;">'--with-mysql-sock=/var/mysql/mysql.sock'</span> <span style="color: #ff0000;">'--with-iodbc=/usr'</span> <span style="color: #ff0000;">'--enable-shmop'</span> <span style="color: #ff0000;">'--with-snmp=/usr'</span> <span style="color: #ff0000;">'--enable-soap'</span> <span style="color: #ff0000;">'--enable-sockets'</span> <span style="color: #ff0000;">'--enable-sysvmsg'</span> <span style="color: #ff0000;">'--enable-sysvsem'</span> <span style="color: #ff0000;">'--enable-sysvshm'</span> <span style="color: #ff0000;">'--with-xmlrpc'</span> <span style="color: #ff0000;">'--with-iconv-dir=/usr'</span> <span style="color: #ff0000;">'--with-xsl=/usr'</span> <span style="color: #ff0000;">'--with-pcre-regex'</span></pre></div></div>

<div id="attachment_467" class="wp-caption alignright" style="width: 310px"><a href="http://www.phidevinc.com/media/2010/03/mysqli-too-short-solved.png" rel="images"><img class="size-medium wp-image-467 " title="mysqli-too-short-solved" src="http://www.phidevinc.com/media/2010/03/mysqli-too-short-solved-300x102.png" alt="" width="300" height="102" /></a><p class="wp-caption-text">Life is good</p></div>
<p>Now, go and grab yourself a cup of coffee, this is going to take a while. After that you should be able to connect to any remote mysql server that you have access to.</p>
<p>If you share your workstation with someone else, then it may be a good idea to <a href="http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html">secure your mysql installation</a>.</p>
<p>Now, in order to make your .htaccess files to work, you need to change your apache user settings. For that you need to go to /etc/apache2/users/USERNAME.conf and make sure it reads something like this<br />
Options Indexes -MultiViews FollowSymLinks<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all</p>
<p>You will also need to change the second AllowOverride that you find in your /etc/apache2/httpd.conf</p>
<p>Well, that should do it. So good luck and let us know if you run into any problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://phidevinc.com/recompiling-php5-in-snow-leopard-with-mysqli-support-and-other-things/tech-tips/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding, Securing &amp; Changing WP-Admin</title>
		<link>http://phidevinc.com/changing-conceailing-and-securing-wp-admin/tech-tips</link>
		<comments>http://phidevinc.com/changing-conceailing-and-securing-wp-admin/tech-tips#comments</comments>
		<pubDate>Sat, 29 Aug 2009 01:05:40 +0000</pubDate>
		<dc:creator>Ares</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-admin]]></category>

		<guid isPermaLink="false">http://docs.phidevinc.com/?p=252</guid>
		<description><![CDATA[Once an open source system becomes so popular as wordpress very often it becomes vulnerable to attacks. I wonder why the folks at wordpress have not done anything to enhance the security of the admin site, which, by default, you &#8230; <a href="http://phidevinc.com/changing-conceailing-and-securing-wp-admin/tech-tips">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_258" class="wp-caption alignright" style="width: 310px"><a title="Not completely a joke" rel="images" href="http://docs.phidevinc.com/media/2009/08/wordpress-installation-is-not-secure.jpg"><img class="size-medium wp-image-258 " title="wordpress-installation-is-not-secure" src="http://docs.phidevinc.com/media/2009/08/wordpress-installation-is-not-secure-300x205.jpg" alt="Your wordpress installation may not be secure" width="300" height="205" /></a><p class="wp-caption-text">Your wordpress installation may not be secure</p></div>
<p>Once an open source system becomes so popular as wordpress very often it becomes vulnerable to attacks. I wonder why the folks at wordpress have not done anything to enhance the security of the admin site, which, by default, you can access by going to /wp-admin.</p>
<div class="clear">&nbsp;</div>
<p><span id="more-252"></span></p>
<p>The problem is that if you rename the directory then your wordpress installation becomes broken. I&#8217;ve looked and I could not find a plug-in that would let you change the wp-admin folder to something else, or at least conceal it. The only result that I found about how to do this is by <a href="http://www.michiknows.com/2007/02/12/who-else-wants-to-hide-their-wordpress-admin-folder/" target="_blank">Michi Kono</a>. However the solution proposed has a few drawbacks like some links no longer working. Of course you have the option of restricting access to selected IP addresses via .htaccess but if you are like most non-commercial internet subscribers you don&#8217;t have a static IP, which makes things more complicated.</p>
<p>So here is another solution to make wordpress more secure while keeping all wordpress functionality.</p>
<div style="float: left;"><script type="text/javascript">// <![CDATA[
  google_ad_client = "pub-8598892091172834"; google_ad_slot = "3691821190"; google_ad_width = 250; google_ad_height = 250;
// ]]&gt;</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></div>
<p>The first thing we need to do is to pick what &#8220;name&#8221; we want for your admin section. For purposes of this &#8220;tutorial&#8221; we will call it &#8220;secure-login&#8221;.</p>
<p><strong><em>Note: You are about to modify crucial files in your wordpress installation. So do this at your own risk, and please, please backup your files before you do this. </em></strong></p>
<p>Now, open your .htaccess file and add the following line after the &#8220;RewriteBase &#8221; line.</p>
<p><strong>RewriteRule ^secure-login$     wp-login.php [L,NC,QSA]</strong></p>
<p>so your .htaccess should look something like this.</p>
<p># BEGIN WordPress<br />
&lt;IfModule mod_rewrite.c&gt;</p>
<p>RewriteEngine On<br />
RewriteBase /<br />
<strong> RewriteRule ^secure-login$ wp-login.php [L,NC,QSA]</strong></p>
<p>RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteRule . /index.php [L]</p>
<p>&lt;/IfModule&gt;</p>
<p># END WordPress</p>
<p>This tells your server that when you ask for &#8220;secure-login&#8221; you should be taken to wp-login.php</p>
<p>Now we need to edit wp-login.php which is located at the root of your installation. Add this before anything else.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//See what file is being requested by the web client, also store the arguments just in case.</span>
<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span><span style="color: #000088;">$arguments</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;?&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//if the user just logged out, destroy this session and redirect them to root</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/wp-login.php?loggedout=true&quot;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;?&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$arguments</span> <span style="color: #339933;">||</span> <span style="color: #0000ff;">&quot;action=logout&quot;</span> <span style="color: #339933;">==</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arguments</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">13</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> <span style="color: #990000;">session_destroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;location: /&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//If our sentinel variable is set and true do nothing, allow normal script execution</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'valid_entrance'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'valid_entrance'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">/* As they say, &quot;Silence is golden&quot; */</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Now if the user is requesting wp-login.php and our sentinel is not true, redirect the &quot;attacker&quot; to root.</span>
<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp-login'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'valid_entrance'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>  <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: /&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//If the user is requesting the right login entrance set the sentinel to true</span>
<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;/secure-login&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>  <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'valid_entrance'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>That&#8217;s all you need to do. Your wordpress installation just became more secure. Don&#8217;t forget to upload your updated files to your server.</p>
<p>I may do a plug-in whenever I find the time.</p>
<p>I would also recommend using <a href="http://wordpress.org/extend/plugins/login-lockdown/">Login Lockdown</a> by Michael VanDeMar.</p>
<p>Let me know if you have any questions or recommendations for this</p>
]]></content:encoded>
			<wfw:commentRss>http://phidevinc.com/changing-conceailing-and-securing-wp-admin/tech-tips/feed</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
	</channel>
</rss>

