How to Create a PHP-Fusion cms website

A collection of tips on howto tweak your Bubba.
Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

How to Create a PHP-Fusion cms website

Post by Eek » 09 Jan 2008, 04:29

This how-to describes the creation of a PHP-Fusion cms website.
If you are new to linux, don't worry. It may look like much, but it isn't. Also where it says vi you can use nano instead.

Bubba2 owners: Also read post http://forum.excito.net//viewtopic.php?t=981 as the Debian and MySQL version differs from the Bubba1 and php5 and MySQL has been pre-installed.

Note: This post is kept up-to-date with the comments and msn contacts made in this thread.
Last update: 1 nov 2008

Packages

Install the packages, using the Debian sources, see Howto install Debian packages [3].

Code: Select all

apt-get install mysql-server
apt-get install wget php4-gd php4-mysql unzip
The installation will require feedback, just accept the defaults. They will be configured later on.
Next download the php-fusion software [1] onto your bubba

Code: Select all

cd /tmp
wget http://surfnet.dl.sourceforge.net/sourceforge/php-fusion/php-fusion-6-01-13-full.zip
MySQL

Now we have a MySQL database running, we need to configure it so it runs with a minimal memory footprint [2] and create a database for php-fusion.

Configuration
Edit the MySQL config

Code: Select all

vi /etc/mysql/my.cnf
Below is my /etc/mysql/my.cnf you could use.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 32K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
query_cache_limit = 1048576
query_cache_size = 8388608
query_cache_type = 0
log-slow-queries = /var/log/mysql/mysql-slow.log
log-bin = /var/log/mysql/mysql-bin.log
max_binlog_size = 104857600
skip-bdb
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
When changes are made, restart MySQL by issueing:

Code: Select all

/etc/init.d/mysql restart
Database
You should now assign a root password to the server, drop the guest account and remove certain built-in databases you don’t need.

Code: Select all

mysql -u root

Code: Select all

mysql> DELETE FROM mysql.user WHERE User = '';
mysql> UPDATE mysql.user SET Password = PASSWORD('some_pass') WHERE User = 'root';
mysql> DELETE FROM mysql.user WHERE Host <> 'localhost';
mysql> UPDATE mysql.user SET Host = '%';
mysql> drop database test;
mysql> FLUSH PRIVILEGES;
mysql> quit;
Login to MySQL, using the password you just created.

Code: Select all

mysql -uroot -p mysql
Create the MySQL database and database user for phpfusion.
In the example below, the database phpfusion is created and a database user phpfusion with password changeme.

Code: Select all

mysql> insert into user values ('localhost','phpfusion',password('changeme'),'Y','Y','Y','Y','Y','Y','N','N','N','N','N','N','N','Y','N','N','Y','Y','Y','N','N','N','N','N','N', 0, 0, 0);

mysql> flush privileges; 
mysql> create database phpfusion;
mysql> exit
PHP-fusion

Install
Unzip the PHP-Fusion package on the bubba and restart Apache.

Code: Select all

mkdir /var/www/html/phpfusion
cd /var/www/html/phpfusion
unzip /tmp/php-fusion-6-01-13-full.zip
chown -R www-data:www-data /var/www/html/phpfusion
/etc/init.d/apache2 restart
Configuration
Read the php-fusion readme in the /var/www/html/phpfusion/ directory.
1. Before you upload the files, rename the file blank_config.php (located in the folder entitled php-files) to config.php.

Code: Select all

mv /var/www/html/phpfusion/php-files/blank_config.php /var/www/html/phpfusion/php-files/config.php
2. Upload the contents of the php-files folder to your web-server.
You can ignore this step as you already did this.
3. Unless you are running PHP-Fusion on a local server, in most cases you will need to CHMOD the following files & folders to 777:

Code: Select all

cd /var/www/html/phpfusion/php-files
chmod 777 administration/db_backups/ 
chmod 777 images/ 
chmod 777 images/imagelist.js 
chmod 777 images/articles/ 
chmod 777 images/avatars/ 
chmod 777 images/news/ 
chmod 777 images/news_cats/ 
chmod 777 images/photoalbum/ 
chmod 777 images/photoalbum/submissions/ 
chmod 777 forum/attachments/ 
chmod 777 config.php 
4. Goto your website, setup.php should start automatically, if it does not appear you should run setup.php manually by entering your full site url followed by /setup.php.
5. Complete the setup process by following all on-screen prompts.
For the Database Hostname, you can accept the default: localhost
6. Immediately after completing the installation of PHP-Fusion you must CHMOD config.php back to 644 AND delete setup.php from your web-server.

Code: Select all

rm /var/www/html/phpfusion/php-files/setup.php
chmod 644 /var/www/html/phpfusion/php-files/config.php 
Setup
You are ready to setup your site!
Surf to your site: http://bubba/phpfusion/php-files/
and login with the administrator account you have created during the configuration.

Have fun
Eek

PS. If you are not sure if this is something for you, you can test it at http://www.opensourcecms.com/index.php? ... iew&id=464, it is a Try Before you Install.

References Appendix: Expose to the outside
If you want to expose your new phpfusion site to the outside, you need to open ports on your router. As you possibly only want to expose phpfusion to the outside, you can create a virtual host in Apache that listens on another port. Next you can use the port forwarding in your router to forward port 80 to the bubba on the new port.
You can use the following instructions to create an Apache virtual host on port 8083

Code: Select all

cd /etc/apache2/sites-available
vi phpfusion
Put the following in the phpfusion file
Listen 8083
NameVirtualHost *:8083
<VirtualHost *:8083>
ServerAdmin webmaster@something.com
DocumentRoot /var/www/html/phpfusion/php-files
DirectoryIndex index.html index.htm index.cgi index.pl index.php index.xhtml
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/phpfusion/php-files>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/phpfusion_error.log
LogLevel warn
CustomLog /var/log/apache2/phpfusion_access.log combined
ServerSignature On
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Enable the site and restart Apache

Code: Select all

cd /etc/apache2/sites-enabled
ln -s /etc/apache2/sites-available/phpfusion
/etc/init.d/apache2 restart
Now the phpfusion site can be accessed by http://bubba:8083

Note: the virtual host has its own error logs and access logs. This is also very handy if you want to check your site errors or statistics. I use webalizer to analyze my web-traffic.
Last edited by Eek on 01 Nov 2008, 02:55, edited 8 times in total.

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 10 Jan 2008, 12:34

Nice Eek this will be a challenge for me to do on my bubba.
Hold your thumbs and toes that this will be ok for me because I have a lot of files on my bubba that i dont want to dissaper in a crach.

sorry 4 my bad svengelsk :lol:

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 11 Jan 2008, 13:54

I got a fail messege like this

Code: Select all

bubba:~# apt-get install mysql wget php4-gd
Reading Package Lists... Done
Building Dependency Tree... Done
Package mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package mysql has no installation candidate
when i do this

Code: Select all

apt-get install mysql wget php4-gd 

pa
Posts: 308
Joined: 06 Dec 2006, 04:38
Location: Sweden
Contact:

Post by pa » 11 Jan 2008, 13:57

It sounds like you have not enabled the standard Debian repositories.
To read up on this see the thread here: http://forum.excito.net/viewtopic.php?t=421

/PA

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 11 Jan 2008, 14:16

pa wrote:It sounds like you have not enabled the standard Debian repositories.
To read up on this see the thread here: http://forum.excito.net/viewtopic.php?t=421

/PA
did that after I write the last messege but it still dont work gott this messege now.

Code: Select all

bubba:~# apt-get install mysql wget php4-gd
Reading Package Lists... Done
Building Dependency Tree... Done
Package mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
W: Couldn't stat source package list http://ftp.se.debian.org sarge/main Packages (/var/lib/apt/lists/ftp.se.debian.org_debian_dists_sarge_main_binary-arm_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://security.debian.org sarge/updates/main Packages (/var/lib/apt/lists/security.debian.org_dists_sarge_updates_main_binary-arm_Packages) - stat (2 No such file or directory)
W: Couldn't stat source package list http://ftp.se.debian.org sarge/non-free Packages (/var/lib/apt/lists/ftp.se.debian.org_debian_dists_sarge_non-free_binary-arm_Packages) - stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Package mysql has no installation candidate

Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Post by Eek » 11 Jan 2008, 14:30

Hi
to get it working, you first edit in or uncomment the debian repositories.
the you do an update

Code: Select all

apt-get update
then you should be able to install mysql wget and php4-gd packages
good luck
Eek

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 11 Jan 2008, 15:06

I have done all things you says but now I gott this messege

Code: Select all

apt-get install mysql wget php4-gd
Reading Package Lists... Done
Building Dependency Tree... Done
Package mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package mysql has no installation candidate

Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Post by Eek » 11 Jan 2008, 15:15

Hi
My mistake. :cry:
the package is called mysql-server and not mysql
try this

Code: Select all

apt-get install mysql-server
apt-get install wget php4-gd php4-mysql

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 12 Jan 2008, 04:09

Got this messege

Code: Select all

 unzip /tmp/php-fusion-6-01-13-full.zip
-bash: unzip: command not found
what is the right command for unziping files?

Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Post by Eek » 12 Jan 2008, 05:43

Hi

it seems i installed more packages then i remembered. :oops:

Code: Select all

apt-get install unzip
you are almost there :)

thanks for going for it !
cheers
Eek

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 12 Jan 2008, 05:56

Ok now I have a new problem :?
I got this blank screen after I have write in localhost user and password
then I hit the button I got this blank screen
Image

Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Post by Eek » 12 Jan 2008, 06:44

Hi

should the url not be http://bubba/phpfusion/php-files/ ?

you could check if the database is up and running and you can login:
mysql -u<username> -p<password> <database>
from the example:

Code: Select all

mysql -uphpfusion -pchangeme phpfusion
If that works, see if the tables have been created

Code: Select all

mysql> show tables;
If that all works you can try and create a config.php file in the directory /var/www/html/phpfusion/php-files

Code: Select all

vi /var/www/html/phpfusion/php-files/config.php
Use following text, change the settings where needed
<?php
// database settings
$db_host="localhost";
$db_user="phpfusion";
$db_pass="changeme";
$db_name="phpfusion";
$db_prefix="fusion_";
define("DB_PREFIX", "fusion_");
?>
good luck
Eek

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 12 Jan 2008, 06:53

:( I thought that I did make the database but when i look up in msql it says 0 tables was found, then I make a new database and I got this messege

Code: Select all

insert into user values ('localhost','phpfusion',password('xxxxxxx'),'Y','Y','Y','Y','Y','Y','N','N','N','N','N','N','N','Y','N','N','Y','Y','Y','N','N','N','N','N','N', 0, 0, 0);
-bash: syntax error near unexpected token `('
:cry: I almost want to give up

I am very familar with php-fusion but not with linux and mysql, and my config.php file is ok

Rawhead
Posts: 42
Joined: 18 Mar 2007, 07:10
Location: Infected mountain in Sweden
Contact:

Post by Rawhead » 12 Jan 2008, 07:15

Ok now I have a database phpfusion and now I got this fail.

Code: Select all

insert into user values ('localhost','phpfusion',password('xxxxxxxx'),'Y','Y','Y','Y','Y','Y','N','N','N','N','N','N','N','Y','N','N','Y','Y','Y','N','N','N','N','N','N', 0, 0, 0);
ERROR 1046: No Database Selected

Eek
Posts: 372
Joined: 23 Dec 2007, 03:03
Location: the Netherlands

Post by Eek » 12 Jan 2008, 07:31

Hi

hang in there!
when you login to mysql as the root user, login in as

Code: Select all

mysql -uroot -p mysql
or you can set the database when you are already logged in

Code: Select all

mysql> use mysql;
the try and create the user and database

Code: Select all

mysql> insert into user values ('localhost','phpfusion',password('changeme'),'Y','Y','Y','Y','Y','Y','N','N','N','N','N','N','N','Y','N','N','Y','Y','Y','N','N','N','N','N','N', 0, 0, 0);
mysql> flush privileges; 
mysql> create database phpfusion; 
You can see if the user is created

Code: Select all

select User from mysql.user;
You can see if the database is created

Code: Select all

show databases;
cheers
Eek

Post Reply