<?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>TAZ: TheTAZZone Network &#187; apache and php tutorials</title>
	<atom:link href="http://www.thetazzone.com/category/security-tutorials/apache-and-php-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetazzone.com</link>
	<description>Welcome to Internet Chaos: 960+ Games; Security, Networking, and General Tutorials; IRC Chat; and an Active Forum Community</description>
	<lastBuildDate>Sun, 22 Nov 2009 02:06:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHPBB Backup &amp; Restore Tutorial</title>
		<link>http://www.thetazzone.com/phpbb-backup-restore-tutorial/</link>
		<comments>http://www.thetazzone.com/phpbb-backup-restore-tutorial/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 11:09:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache and php tutorials]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.thetazzone.com/?p=1456</guid>
		<description><![CDATA[ORIGINALLY POSTED BY Omen FOR THETAZZONE/TAZFORUM HERE
Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to [...]]]></description>
			<content:encoded><![CDATA[<p>ORIGINALLY POSTED BY Omen FOR THETAZZONE/TAZFORUM <a href="http://tazforum.thetazzone.com/viewtopic.php?f=31&amp;t=11048">HERE</a></p>
<p>Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network</p>
<p><span style="font-weight: bold;">PHPBB3 – backup &amp; restore tutorial (this tutorial should apply to other forum/bbs on mysql)</span></p>
<p>For this tutorial we will use several methods to backup and restore mysql databases.</p>
<p>Since you are reading this guide and need to back the database then you may already have a running server or have it hosted somewhere, for those who don’t have a server here is some software to get you hosting.</p>
<p>These downloads are for Windows, but the back up process is more or less universal.</p>
<p><span style="font-weight: bold;">SERVERS</span><br />
Appserv: <!-- m --><a class="postlink" href="http://www.appservnetwork.com/">http://www.appservnetwork.com/</a><!-- m --><br />
Wamp server: <!-- m --><a class="postlink" href="http://www.wampserver.com/en/download.php">http://www.wampserver.com/en/download.php</a><!-- m --><br />
XAMPP: <!-- m --><a class="postlink" href="http://www.apachefriends.org/en/xampp-windows.html">http://www.apachefriends.org/en/xampp-windows.html</a><!-- m --></p>
<p><span style="font-weight: bold;">MYSQL ADDON</span><br />
PHPmyAdmin: <!-- m --><a class="postlink" href="http://www.phpmyadmin.net/home_page/downloads.php">http://www.phpmyadmin.net/home_page/downloads.php</a><!-- m --> &lt;&lt; this eases MYSQL administration by providing a web interface.</p>
<p>Please Read this tutorial from beginning to end first, I am not any good at writing and tend to write in parallel, so some stuff may apply to you some might not.</p>
<p><span style="font-weight: bold;">Considerations:</span><br />
• Any forum mods for any forum/s, will molest the database and your forum: most mods aren’t updated or thoroughly tested, this means you will have to install exactly the same mods onto your forum for your database to work properly.<br />
•	Usually the new (restore) forum version and the mods version/s have to be the same version as the old (backup).<br />
•	Large SQL files are messy and a real pain to restore.</p>
<p>There are lots of ways to back up your phpbb, a full backup includes your entire phpbb directory and the full SQL database (or at least the part where phpbb was).</p>
<p>If your host backs up your site, then it should be a full backup. Backing up the database yourself isn’t so difficult, follow the steps.</p>
<p><span style="font-size: 150%; line-height: 116%;"><span style="font-weight: bold;">BACKUP</span></span></p>
<p>1. The UI content (suggest a better name for the files, if you have one)<br />
Use your favourite ftp client to download the entire phpbb directory and all its contents, this is needed if you installed any mods or would like to see any uploaded stuff in your restored forum.<br />
Skip this if you Have PHPBB3 with SQL attachments &amp; haven’t installed any mods.</p>
<p>2a. Backup SQL data – via PHPBB<br />
SQL holds everything important, backing it up once in a while will save you hair and your friends (everybody hates re-registering for a failed/deleted SQL forum).<br />
Lets assume you have your forum installed and running, log into the “administrators control panel” then select the “Maintenance” tab and click on “Backup” in the menu.</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img257.imageshack.us/img257/1348/phpbb3backup1avc2.png" alt="Image" width="460" height="400" /></a></p>
<p>Select “Full” , “GZIP” , “STORE AND DOWNLOAD” , then click “SELECT ALL” and then click “SUBMIT”</p>
<p>Save the file somewhere.<br />
That’s it you’re done.</p>
<p>NOTE: <span style="font-size: 75%; line-height: 116%;">Ticking “Store and download” makes a backup in the “phpbb/store” (phpbb = where your phpbb is installed) directory so you can restore via the restore option. </span></p>
<p>2b. Backup SQL data – via phpMyAdmin<br />
Most *nix web hosts will have phpMyAdmin installed, usually it’s only accessible via your host’s control panel. Click on phpmyadmin (in your control panel, could be found under database management) or<!-- m --> <a class="postlink" href="http://yourdomain.com/phpmyadmin">http://yourdomain.com/phpmyadmin</a><!-- m --> , so your screen looks like this:</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img233.imageshack.us/img233/2999/phpbb3backup5atw8.png" alt="Image" width="460" height="400" /></a></p>
<p>Find your phpbb3 database in the &#8220;existing databases&#8221; list and click on it, then click on the export tab, you should see this:</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img217.imageshack.us/img217/10/phpbb3backup16asi2.png" alt="Image" width="460" height="400" /></a></p>
<p>Lets start clicking, click &#8220;SELECT ALL&#8221; (NOTE: if you have only one database with more than just phpbb3 then you need to select ONLY the tables beginning with &#8220;phpbb_&#8221;), then click in the &#8220;SQL&#8221; select circle, then click &#8220;SAVE AS A FILE&#8221;, then &#8220;ZIPPED&#8221; and lastly click the &#8220;GO&#8221; button to have a download pop-up, now save your phpbb SQL data somewhere.<br />
That’s it you’re done.</p>
<p><span style="font-size: 150%; line-height: 116%;"><span style="font-weight: bold;">RESTORE</span></span></p>
<p>3a. Restoring via PHPBB3<br />
You will need to install phpbb3, keeping the phpbb3 administrator settings &amp; table prefix the same as your previous forum !</p>
<p>After you have installed your forum, use your favourite FTP client to upload the &#8220;SQL&#8221; file to phpbb/store , look at picture to understand the directory structure.</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img516.imageshack.us/img516/5963/phpbb3backup13be3.png" alt="Image" /></a></p>
<p>Now, login into your phpbb &#8220;ADMINISTRATOR CONTROL PANEL&#8221;, go to &#8220;MAINTENANCE&#8221; tab, then &#8220;RESTORE&#8221;. If you have done the previous bit correctly you should see this:</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img516.imageshack.us/img516/1624/phpbb3backup14ud4.png" alt="Image" /></a></p>
<p>If, however you uploaded the &#8220;SQL&#8221; files to the incorrect directory you will see this:</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img378.imageshack.us/img378/5026/phpbb3backup12br3.png" alt="Image" width="460" height="400" /></a></p>
<p>If you don&#8217;t see any backups, retrace your steps and learn the directory structure of phpbb/store.<br />
If you do se a backup or two, select the one you would like to restore and click start restore.<br />
That&#8217;s it you&#8217;re done !</p>
<p>3a. Restoring via phpMyAdmin<br />
Lets go back to phpmyadmin, either through your hosts control panel or directly <!-- m --><a class="postlink" href="http://yourdomain.com/phpmyadmin">http://yourdomain.com/phpmyadmin</a><!-- m --></p>
<p>Select your pbpbb database from the existing databases and click on it, then click on the &#8220;IMPORT&#8221; tab, then click the &#8220;BROWSE&#8221;</p>
<p><a class="postlink" href="http://imageshack.us/"><img src="http://img146.imageshack.us/img146/9379/phpbb3backup8avh7.png" alt="Image" width="460" height="400" /></a></p>
<p>Select your saved &#8220;SQL&#8221; backup file (either zipped, gzipped or plain sql)<br />
and then click the &#8220;GO&#8221; button.<br />
If you get &#8220;Import has been successfully finished, 212 queries executed.&#8221; displayed on this same page, then you have restored your pbpbb backup. The number of queries will vary according to the size of your forum.</p>
<p>I would like this tut to be informative and undestandable, comments &amp; corrections welcome.</p>
<p>PDF = <!-- m --><a class="postlink" href="http://rapidshare.com/files/134613074/backup_restore-phpbb3.pdf">http://rapidshare.com/files/134613074/b &#8230; phpbb3.pdf</a><!-- m --></p>
<p>03 August 2008 &#8211; PBPBB Backup &amp; Restore Tutorial Release</p>


<!-- Begin TwitThis script (http://twitthis.com/) -->
<div style="text-align:left;">
<script type="text/javascript" src="http://s3.chuug.com/chuug.twitthis.scripts/twitthis.js"></script>
<script type="text/javascript">
<!--
document.write('<a href="javascript:;" onclick="TwitThis.pop();"><img src="http://s3.chuug.com/chuug.twitthis.resources/twitthis_grey_72x22.gif" alt="TwitThis" style="border:none;" /></a>');
//-->
</script>
</div>
<!-- /End -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetazzone.com/phpbb-backup-restore-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Apache, Postgresql, and PHP installation</title>
		<link>http://www.thetazzone.com/apache-postgresql-and-php-installation/</link>
		<comments>http://www.thetazzone.com/apache-postgresql-and-php-installation/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 11:03:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache and php tutorials]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.thetazzone.com/?p=1454</guid>
		<description><![CDATA[ORIGINALLY POSTED BY Vorlin FOR THETAZZONE/TAZFORUM HERE
Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to [...]]]></description>
			<content:encoded><![CDATA[<p>ORIGINALLY POSTED BY Vorlin FOR THETAZZONE/TAZFORUM <a href="http://tazforum.thetazzone.com/viewtopic.php?f=31&amp;t=11912">HERE</a></p>
<p>Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network</p>
<p>Written based on experience by: THE Vorlin on 12/4/08 @ 09:00. No plagiarism was done (as far as I know) and if any part looks like something one might have written, it&#8217;s purely coincidental. This tutorial is written for those who don&#8217;t want any fuss over installing three sources at once and have tons of problems.</p>
<p>In this tutorial, the integration of Postgresql 8, Apache 2, and Php 5 will be discussed. I know that there are tutorials abound out there about how to do it with mySQL (LAMP &#8211; Linux Apache MySQL PHP) but I&#8217;ve seen few concerning PostgreSQL so that&#8217;s what this tutorial is for. I will [b]disclaim[/b] now that there are better people than I to write it, but since I use it all the time and have done setups for it more than I can count, here goes.</p>
<p>I&#8217;m performing this installation on my own machine which is running Vector Linux 5.9 Stable.</p>
<p>[b]REQUIREMENTS:[/b]<br />
Linux (of course, pretty much any distro works)<br />
Apache 2 (latest is 2.2.10, available from www dot apache dot org)<br />
PHP 5 (latest is 5.2.6, available from www dot php dot net)<br />
PostgreSQL 8 (latest is 8.3.5, available from www dot postgresql dot org)<br />
gcc (your compiler)<br />
gunzip or bunzip2 AND tar (depending on package, these are the decompression tools)<br />
sudo (needed for root access parts)</p>
<p>Step 0. Download the latest source files for each one from their site. You&#8217;ll have three total. You can download either the .tar.gz or the .tar.bz2 types. I go for the bz2 as it&#8217;s got better compression than gzip. In the end, you&#8217;ll have httpd-2.2.10.tar.bz2, php-5.2.6.tar.bz2, and postgresql-8.3.5.tar.bz2.</p>
<p>Step 1. Using bunzip2 or gunzip (extentions bz2 and gz respectively), unpack each one. That will leave 3 tar files. We&#8217;ll use bunzip2 as example.<br />
[code]<br />
$ bunzip2 httpd-2.2.10.tar<br />
$ bunzip2 php-5.2.6.tar<br />
$ bunzip2 postgresql-8.3.5.tar<br />
[/code]<br />
Step 2. Using tar, untar each one.<br />
[code]<br />
$ tar xvf httpd-2.2.10.tar<br />
$ tar xvf php-5.2.6.tar<br />
$ tar xvf postgresql-8.3.5.tar.tar<br />
[/code]</p>
<p>Now, the funny thing about this part is that you can&#8217;t just compile things in any order. The correct order is as follows. First, we configure and install apache, then comes postgresql, then lastly, php. PHP is last because the files needed are built when apache and postgresql are built.  NOTE: all configurations below, as well as the compiling, can be done as yourself. When you run &#8216;make install&#8217;, though, you&#8217;ll have to have root permissions. Generally, this is where sudo comes in, assuming you have sudo capabilities (&#8217;sudo make install&#8217;). Also, running &#8216;make&#8217; will take some time on all of them, and running &#8216;make test&#8217; after &#8216;make&#8217; on php will take a significantly long time (there&#8217;s over 4000 tests).</p>
<p>[b]Configuring Apache 2.2.10[/b]<br />
There&#8217;s a lot of configuration options for apache but we&#8217;re only going to be using two of them for brevity. We won&#8217;t be including cgi scripting and we&#8217;ll be changing the directory where it resides. By default, it will install into [i]/usr/local/apache2[/i]. We&#8217;re going to change that to [i]/usr/local/apache[/i] simply because I don&#8217;t like the 2 there, hehe, however, you can install it to whatever you want and put it wherever you want.<br />
[code]<br />
$ cd httpd-2.2.10<br />
$ ./configure --prefix=/usr/local/apache --disable-cgi<br />
$ make<br />
$ sudo make install<br />
[/code]</p>
<p>With luck, it will compile and install without any problems. You can now &#8216;cd /usr/local/apache&#8217; and run an &#8216;ls&#8217; and see that there&#8217;s all kinds of directories there, mainly bin, htdocs, conf, and logs. Once again, you have to have root permission to start the server and if you try to start it as yourself, you&#8217;ll get this:<br />
[quote](13)Permission denied: make_sock: could not bind to address 0.0.0.0:80<br />
no listening sockets available, shutting down<br />
Unable to open logs[/quote]</p>
<p>Also, if you run the command &#8216;apachectl&#8217; in your home directory or somewhere other than /usr/local/apache/bin, you&#8217;ll probably get this:<br />
[quote]<br />
sudo: apachectl: command not found<br />
[/quote]</p>
<p>This means you&#8217;ll need to add /usr/local/apache/bin to your PATH variable which is easy enough or have symbolic links created from /usr/local/apache/bin to /usr/bin or /bin or something like that. NOTE: if you have sym links created, it&#8217;s best to never rename an executable in case you upgrade later as it just causes confusion.<br />
You can create sym links like this, and yes, sudo is required.<br />
[quote]<br />
$ cd /usr/local/apache/bin<br />
$ for i in `ls`<br />
do<br />
sudo ln -s /usr/local/apache/bin/$i /usr/local/bin/$i &amp;&amp; echo $i created in /usr/local/bin<br />
done<br />
[/code]</p>
<p>You'll get the following:<br />
[quote]<br />
ab created in /usr/local/bin<br />
apachectl created in /usr/local/bin<br />
apxs created in /usr/local/bin<br />
checkgid created in /usr/local/bin<br />
dbmmanage created in /usr/local/bin<br />
envvars created in /usr/local/bin<br />
envvars-std created in /usr/local/bin<br />
htcacheclean created in /usr/local/bin<br />
htdbm created in /usr/local/bin<br />
htdigest created in /usr/local/bin<br />
htpasswd created in /usr/local/bin<br />
httpd created in /usr/local/bin<br />
httxt2dbm created in /usr/local/bin<br />
logresolve created in /usr/local/bin<br />
rotatelogs created in /usr/local/bin<br />
[/quote]</p>
<p>Finally, to start the server using the default httpd.conf settings (that file is in /usr/local/apache/conf), run the following.<br />
[code]<br />
$ sudo /usr/local/apache/bin/apachectl start<br />
[/code]<br />
You won't get anything back unless there's an error, so don't worry about that. To test it, you can open your browser to localhost:80 or you can telnet to your machine, port 80, and hopefully get the following. If you get a connection refused, something's wrong with the configuration of apache or something else.<br />
[quote]<br />
$ /usr/local/apache/logs &gt;telnet localhost 80<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
[/quote]<br />
To get out of the telnet, just hit control-] and then type 'close' and your telnet session is over.<br />
At this point, you have a fully functional apache web server running on your machine and are now free to create as much content as you want. Next is the Postgresql setup.</p>
<p>[b]Configuring PostgreSQL 8.3.5:[/b]<br />
The configuration for PostgreSQL isn't so bad, there's just some switching around especially if you're compiling from source like we are. To save some trouble before we configure and install, there's some things we can do first and not worry about later. First, we need to create the postgres user and then create the directory where you want everything installed, mainly the database cluster (IMPORTANT!!). After that we'll need to create the main directory where Postgres will live. Usually, it's in /opt/Postgresql-/ but we're not using that this time. It will be installed in /usr/local/pgsql which doesn't exist. The data directory in /usr/local/pgsql is where the database cluster will live and has to have very strict permissions, otherwise pg_ctl/postmaster will complain when you try to run initdb or start the server.</p>
<p>To create the postgres user, create the postgres group,  and the /usr/local/pgsql directory:<br />
[code]<br />
$ sudo useradd -m -c "Postgres user" postgres<br />
$ sudo groupadd postgres<br />
$ sudo passwd postgres<br />
$ sudo mkdir /usr/local/pgsql<br />
$ cd /usr/local/pgsql<br />
$ sudo mkdir data &amp;&amp; sudo chown -R postgres.postgres data<br />
$ sudo chmod -R 700 data<br />
[code]<br />
At this point, you have a user postgres that will handle all of the startups and shutdowns as well as a group postgres. The passwd command that we used needs to have a password given to postgres so that you can sign in later. The /usr/local/pgsql directory has been created as well as the data directory, which had permissions (chown) changed to 700, which means only the owner and root can ever see anything in there. It's also owned by group postgres. Now we can go back to the postgres directory in our home directory and get the configuration going.</p>
<p>[code]<br />
$ cd $HOME/postgresql-8.3.5<br />
[/code]</p>
<p>We'll be doing a very similar ./configure from here like we did with Apache (and will do with PHP later). Some options that I normally use will not be in here as this is for basic configuration. The more you use and learn about PostgreSQL, you'll figure out just how you want your setup to be. That also means that you'll have to run ./configure again on the source code to recompile with these new settings. The only setting I'm using is the --with-perl just as an example. In all configure scripts, you can run ./configure --help and it'll show you all available options for whatever you're trying to install. We'll then do the typical 'make' and 'make install'.<br />
[code]<br />
$ ./configure --with-perl<br />
$ make<br />
$ sudo make install<br />
[/code]<br />
After this is successfully done, you'll have all the binaries you need built and everything's been installed into /usr/local/pgsql. To make life easier, like with Apache, go into the bin directory and create symbolic links for everything to be in /usr/local/bin.<br />
[code]<br />
$ cd /usr/local/pgsql/bin<br />
$ for i in `ls`<br />
do<br />
ln -s /usr/local/pgsql/bin/$i /usr/local/bin/$i &amp;&amp; echo $i created in /usr/local/bin<br />
done<br />
[/code]<br />
Now we need to start the server. The password you assigned to user postgres earlier is in need now. We'll run the which command that shows us which command we'll be using, in this case, it's pg_ctl. All the information you should see is listed and you'll notice I added some additional options to initdb, mainly -E for encoding and --locale for the locale that the database cluster will be using. The UTF-8 encoding and locale is the easiest and causes a lot less problems (cough, phpBB3, cough). NOTE: all databases you create after the cluster has been initialized will have this encoding and locale unless you specify otherwise with the 'createdb' options. This is done with 'initdb'.<br />
[code]<br />
$ su - postgres</p>
<p>$ which pg_ctl<br />
/usr/local/bin/pg_ctl<br />
postgres:$ initdb -E utf8 --locale=en_US.UTF-8 /usr/local/pgsql/data<br />
The files belonging to this database system will be owned by user "postgres".<br />
This user must also own the server process.</p>
<p>The database cluster will be initialized with locale en_US.UTF-8.<br />
The default text search configuration will be set to "english".</p>
<p>fixing permissions on existing directory /usr/local/pgsql/data ... ok<br />
creating subdirectories ... ok<br />
selecting default max_connections ... 100<br />
selecting default shared_buffers/max_fsm_pages ... 24MB/153600<br />
creating configuration files ... ok<br />
creating template1 database in /usr/local/pgsql/data/base/1 ... ok<br />
initializing pg_authid ... ok<br />
initializing dependencies ... ok<br />
creating system views ... ok<br />
loading system objects' descriptions ... ok<br />
creating conversions ... ok<br />
creating dictionaries ... ok<br />
setting privileges on built-in objects ... ok<br />
creating information schema ... ok<br />
vacuuming database template1 ... ok<br />
copying template1 to template0 ... ok<br />
copying template1 to postgres ... ok</p>
<p>WARNING: enabling "trust" authentication for local connections<br />
You can change this by editing pg_hba.conf or using the -A option the<br />
next time you run initdb.</p>
<p>Success. You can now start the database server using:</p>
<p>postgres -D /usr/local/pgsql/data<br />
or<br />
pg_ctl -D /usr/local/pgsql/data -l logfile start<br />
[/code]<br />
Now you can start the server up as postgres and will see the following.<br />
[code]<br />
$ pg_ctl -D /usr/local/pgsql/data -l logfile start<br />
server starting<br />
[/code]<br />
You can 'cat logfile' and see what all was stated but if you get that message about the server starting, you're ok to go. Now, let's create your first database. That's done with 'createdb' and we'll use 'forum' as the db we're creating.<br />
[code]<br />
$ createdb forum<br />
[/code]<br />
If nothing was returned (like an error message about conflicting encoding and locale settings), then you now have a database named 'forum'. To allow other users able to connect and make changes, you'll have to use the 'createuser' command. We'll create a superuser 'vorlin' for example which means tester can do pretty much anything. I use 'vorlin' since that's my username on the linux server I have and it should be noted that roles created should be the same as those on the box as it makes it easier. You create user roles for the database that don't exist on the box but it's advisable to use the option to password-protect them when you create the database (see createdb --help). And since we're still logged in as postgres, we'll have to exit out.<br />
[code]<br />
$ createuser vorlin<br />
Shall the new role be a superuser? (y/n) y<br />
[/code]<br />
There's now a role named 'vorlin' that can connect (to any database created, no matter who owns it), create databases, drop databases, change or otherwise modify anything in said database, etc.<br />
[code]<br />
$ whoami<br />
postgres<br />
$ exit<br />
$ whoami<br />
vorlin<br />
$ psql forum<br />
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.</p>
<p>Type:  \copyright for distribution terms<br />
\h for help with SQL commands<br />
\? for help with psql commands<br />
\g or terminate with semicolon to execute query<br />
\q to quit</p>
<p>forum=#<br />
[/code]<br />
And that's it, you have a successful database created, a role created, and connected to it. To get rid of the database, all you have to do is 'dropdb forum' and as long as nobody's connected to it or there aren't any idle connections (see php's pg_pconnect for persistent connections), it'll be deleted. NOTE: the postgresql server can't be started or even stopped by root and it can't be started or stopped by using sudo. Next is PHP's configuration.</p>
<p>[b]Configuring PHP:[/b]<br />
PHP doesn't have to have a lot of configuration options set since the basic ones already at default do pretty good. You can change things later via editing the php.ini file, but once again, './configure --help' will show everything that you can enable/disable as well as whether or not that setting in particular is set by default.</p>
<p>Run the now-known configure script in the php-5.2.6 directory with any settings you want to set. Since we're building php with the apache module and postgresql support, we'll need to set those options. These two settings are important since the --with-pgsql= will tell php what the settings are and such, and --with-apxs2=/usr/local/apache/bin/apxs will tell php where the apache 2 apxs command is that it will need. I've listed below the files and directories as to where they would be found using /usr/local as the base directory.</p>
<p>BIG NOTE: php has a 'make test' that they recommend you run after a successful compilation. You don't have to run it, but I did the first time, so I recommend you do too. It's over 4000 tests and if you have a pretty decent machine, it'll run pretty fast and take around 10-15 minutes. Yes, you read that right. If you're on a slow(er) machine, go ahead and go to the mall or watch a movie. Some things will fail, but that's ok.</p>
<p>[u]FILES:[/u]<br />
Apache: /usr/local/apache/bin/apxs (note: even though php's setting is --with-apxs2, it's just apxs)<br />
Postgres: /usr/local/pgsql/bin/pg_conf</p>
<p>[code]<br />
$ cd $HOME/php-5.2.6<br />
$ ./configure --with-pgsql=/usr/local/pgsql/bin/pg_config --with-apxs2=/usr/local/apache/bin/apxs2<br />
$ make<br />
$ make test<br />
$ sudo make install<br />
[/code]</p>
<p>Now that php's been successfully configured, tested, and installed, it'll have put three files into /usr/local/bin. Those are the php binary itself, phpize, and php-config. The php binary will be used quite extensively, both with apache as well as any scripts you want to write in php itself on the command line. If you run a secured website and you don't want users to use php on the command line, just compile it with the added --disable-cli setting. This will build and install the module for apache's 2.x support and allow postgresql commands to be executed, but no php binary will be built.</p>
<p>To test the php binary, you can do one of two things (or both).</p>
<p>The first option is to check for the version.<br />
[code]<br />
$ which php<br />
/usr/local/bin/php<br />
$ php -V<br />
PHP 5.2.6 (cli) (built: Dec  5 2008 20:55:24)<br />
Copyright (c) 1997-2008 The PHP Group<br />
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies<br />
[/code]</p>
<p>The second option is to create a simple html file in our new directory /usr/local/apache/htdocs and use the 'phpinfo();' function. It'll look like the following given. The file will be listed as 'test.php'.<br />
[quote]<br />
phpinfo();<br />
?&gt;<br />
[/quote][/quote]</p>
<p>That should show a pretty sizable page of php's configuration. Once shown, you can get rid of that test.php file.</p>
<p>CONCLUSION:<br />
Hopefully this helps anyone who's looking to make a LAPP setup. I know I've done it enough times (with PostgreSQL) and decided just to write up something for me to use in case anything slipped on how I did it before, hehe.</p>
<p>--Vorlin :: proponent of [url=http://tazforum.thetazzone.com]The Taz Security/IT/Programming site[/url]</p>


<!-- Begin TwitThis script (http://twitthis.com/) -->
<div style="text-align:left;">
<script type="text/javascript" src="http://s3.chuug.com/chuug.twitthis.scripts/twitthis.js"></script>
<script type="text/javascript">
<!--
document.write('<a href="javascript:;" onclick="TwitThis.pop();"><img src="http://s3.chuug.com/chuug.twitthis.resources/twitthis_grey_72x22.gif" alt="TwitThis" style="border:none;" /></a>');
//-->
</script>
</div>
<!-- /End -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetazzone.com/apache-postgresql-and-php-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
