<?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>NonStopSites Blog &#187; PHP</title>
	<atom:link href="http://blog.nonstopsites.us/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nonstopsites.us</link>
	<description>Dynamic Websites Done Right!</description>
	<lastBuildDate>Sat, 24 Jul 2010 06:02:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP, Apache, mySQL and Vista</title>
		<link>http://blog.nonstopsites.us/php-apache-mysql-and-vista/</link>
		<comments>http://blog.nonstopsites.us/php-apache-mysql-and-vista/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 03:16:51 +0000</pubDate>
		<dc:creator>Sech</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://blog.nonstopsites.us/?p=88</guid>
		<description><![CDATA[This is an interesting one that certainly deserves its own post here. It took me a while to find this solution. Here goes: So you set your development environment in Windows Vista by installing apache, php, perl and mysql. You point your browser to your php script that uses mysql connection and this is what [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>This is an interesting one that certainly deserves its own post here. It took me a while to find this solution. Here goes:</p>
<p>So you set your development environment in Windows Vista by installing apache, php, perl and mysql. You point your browser to your php script that uses mysql connection and this is what you get:</p>
<blockquote><p>Call to undefined function mysql_connect()</p></blockquote>
<p>What a disappointment!</p>
<p>Go to your php directory and open your php.ini file. If you followed <a href="http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/" title="Installing Apache, Perl &#038; PHP on Windows">my previous post</a> about installing php, your directory should be located in C:\PHP. Here are the changes you need to make in php.ini file:</p>
<p>1)Set the extension directory by finding the line that starts with "extension_dir" and changing to<br />
extension_dir = "C:\php\ext"</p>
<p>2)Uncomment the following line by removing ";" at the start of the line.<br />
extension=php_mysql.dll</p>
<p>Restart apache and go back to your script.</p>
<p>There is a possibility you will get a cryptic Windows Vista Error telling you that the server stopped working and Windows Vista will inform you when a solution found. Nice!</p>
<p>Here is the solution when php and mysql crash apache server in Vista:</p>
<p>1) Go to your mysql installation directory and rename libmysql.dll to libmysql.dll.bak just in case something else goes wrong. libmysql.dll is located in BIN directory in your mysql installation directory.</p>
<p>2) Go to your php installation directory -- C:\PHP in my case -- and copy libmysql.dll located here to your-mysql-install-dir\bin where the one we renamed was.</p>
<p>3) Restart apache.</p>
<p>Hopefully your php script with mysql connection will work now.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://blog.nonstopsites.us/php-apache-mysql-and-vista/')" href="http://www.sphere.com/search?q=sphereit:http://blog.nonstopsites.us/php-apache-mysql-and-vista/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.nonstopsites.us/php-apache-mysql-and-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if a file exists on another domain</title>
		<link>http://blog.nonstopsites.us/check-if-a-file-exists-on-another-domain/</link>
		<comments>http://blog.nonstopsites.us/check-if-a-file-exists-on-another-domain/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 05:56:56 +0000</pubDate>
		<dc:creator>Sech</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.nonstopsites.us/?p=82</guid>
		<description><![CDATA[PERL: Use LWP::Simple and the head function. use LWP::Simple; my $url = 'http://some.server.com/file.gif'; if (head($url)) { # file is there } else { # file is missing } Credit goes to perlmonks.org. PHP: Use get_headers $fileUrl = 'http://some.server.com/file.gif'; $AgetHeaders = @get_headers($fileUrl); if (preg_match("&#124;200&#124;", $AgetHeaders[0])) { # file is there } else { # file is [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p><strong>PERL:</strong></p>
<p>Use LWP::Simple and the head function.</p>
<blockquote><p>use LWP::Simple;</p>
<p>my $url = 'http://some.server.com/file.gif';</p>
<p>if (head($url)) {<br />
  # file is there<br />
} else {<br />
  # file is missing<br />
}</p></blockquote>
<p>Credit goes to <a href="http://www.perlmonks.org/?node_id=112853">perlmonks.org</a>.</p>
<p><strong>PHP:</strong></p>
<p>Use get_headers</p>
<blockquote><p>$fileUrl = 'http://some.server.com/file.gif';<br />
$AgetHeaders = @get_headers($fileUrl);<br />
if (preg_match("|200|", $AgetHeaders[0])) {<br />
 # file is there<br />
} else {<br />
 # file is missing<br />
} </p></blockquote>
<p>Credit goes to <a href="http://us2.php.net/file_exists">php.net</a>.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://blog.nonstopsites.us/check-if-a-file-exists-on-another-domain/')" href="http://www.sphere.com/search?q=sphereit:http://blog.nonstopsites.us/check-if-a-file-exists-on-another-domain/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.nonstopsites.us/check-if-a-file-exists-on-another-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Apache, Perl &amp; PHP on Windows</title>
		<link>http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/</link>
		<comments>http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 06:27:17 +0000</pubDate>
		<dc:creator>Sech</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.nonstopsites.us/?p=71</guid>
		<description><![CDATA[Every once in a while I need to install Apache http server on my pc or laptop to use as local test server. I also need to install Perl, PHP and mysql to have the complete environment to test scripts and applications before uploading them on a live server. Ricocheting.com has a great tutorial for [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>Every once in a while I need to install Apache http server on my pc or laptop to use as local test server. I also need to install Perl, PHP and mysql to have the complete environment to test scripts and applications before uploading them on a live server.</p>
<p>Ricocheting.com has a great <a href="http://www.ricocheting.com/server/" target="_blank">tutorial</a> for installing Apache, PHP and Perl on a Windows server. Last time I had to do a re-install on my PC, I followed their tutorial.</p>
<p>A few impressions and comments:</p>
<p>1) They recommend staying with the default installation of Apache and changing "DocumentRoot" later. I change the installation location to "C:\Apache" which defaults DocumentRoot to C:\Apache\htdocs. It is much better to do it this way. You will not need to modify the configuration file to set DocumentRoot. You will not need to dig into all the way to C:\Program Files\Apache\... to look at log files or configuration files either. </p>
<p>2) I loved their tip about where to install ActiveState Perl: "<strong>C:\usr</strong>". I used to install Perl to C:\Perl directory which forced me to change the shebang lines on scripts. Listen to this:</p>
<blockquote><p>If you will be using Perl CGI programs and want to maintain some level of portability between both Linux machines and Windows machines, you will want to install Perl to the same location on your Windows machine that it is on most Linux machines.</p>
<p>For example, on a standard Linux machine, Perl is located at /usr/bin/perl and so every Perl program that I write begins with #!/usr/bin/perl. So, when I install Perl on a Windows machine, instead of installing it in the default location (which is E:\perl for ActivePerl) I install it in E:\usr so that the Perl executable is located at /usr/bin/perl. This allows me to write code on my Windows machine, then move it (without making any changes) to a Linux machine and have it run there. And vice versa. </p></blockquote>
<p>Wow! I wish I had figured this out earlier... "<strong>#!/usr/bin/perl</strong>" works in windows if you install Perl in C:\usr directory. No, you do not need to have "C:\" on the shebang line. This will save a lot of time and headache.</p>
<p>3) The site also includes the lines required to be added in Apache configuration file to make CGI and PHP work. I will put a copy of these here:</p>
<p>To activate CGI:<br />
Edit the Apache httpd.conf Configuration File and search for Options Indexes FollowSymLinks (about line 190) when you find it add ExecCGI to the end so it looks like </p>
<p><strong>Options Indexes FollowSymLinks ExecCGI </strong></p>
<p>To use CGI outside the cgi-bin directory, uncomment:<br />
#<strong>AddHandler cgi-script .cgi</strong><br />
Also add .pl behind .cgi so 'perl' extension is also treated as cgi files.</p>
<p>To use PHP at the very end of the httpd.conf file add the following lines:</p>
<p>	<strong>LoadModule php5_module "C:/php/php5apache2_2.dll"</strong><br />
	<strong>AddType application/x-httpd-php .php</strong><br />
	<strong>PHPIniDir "C:/php"</strong></p>
<p>Also Open php.ini in a text editor and scroll down about halfway through the file and look for doc_root then change it to point to whatever your Apache DocumentRoot is set to. In my case: doc_root = "C:\Apache\htdocs" </p>
<p>To get Apache to automatically look for an index.php, and index.pl search httpd.conf for DirectoryIndex (about line 212) and add the files you want Apache to look for when a directory is loaded (if it doesn't find any of these files, it displays folder contents). Mine looks like: </p>
<p><IfModule dir_module><br />
<strong>     DirectoryIndex index.php index.pl index.html</strong><br />
</IfModule></p>
<p>They also have information on installing MySQL which is pretty straightforward. </p>
<p>There is one thing I would like to add here though: If you want to use DBD-MySQL package with Perl , you will notice that it is not included in the latest ActiveStatePerl distribution. You can't even install it using the GUI ppm. Here is what you need to do:</p>
<p>At the Command Prompt type:</p>
<p><strong>ppm install http://theoryx5.uwinnipeg.ca/ppms/DBI-mysql.ppd</strong></p>
<p>UPDATE on Jan 9, 2009 >>></p>
<p>If you use ActiveState Perl 5.10, above link will not work either. The easiest way to do this is to start your Perl Package Manager, click on Edit -> Preferences and click on the Repositories tab. Type "http://cpan.uwinnipeg.ca/PPMPackages/10xx/" in Location. You just installed the Repository that has the DBD-MySQL package which will enable you to install it using your Perl ppm.</p>
<p>It sure will be nice to have all this info ready when I need to install Apache, Perl, PHP and MySQL on Windows next time.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/')" href="http://www.sphere.com/search?q=sphereit:http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.nonstopsites.us/installing-apache-perl-php-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
