Development

InstallingSymfonyOnSUSE100

You must first sign up to be able to contribute.

Installing Symfony on SUSE 10.0

A SUSE package is also available in the server:php:applications repository:

http://software.opensuse.org/download/server:/php:/applications/

This howto (first posted on 12 May 2006) should help you get Symfony up and running on SUSE 10.0. It includes some pieces that are not strictly relevant to Symfony (eg Smart, PEAR), but they are included here so that you do not have to go jumping about between too many webpages. We will be going through the following steps:

  • (1) Installing Smart package manager (this is optional, but it is a useful tool for your SUSE 10.0 system)
  • (2) Installing required SUSE 10.0 packages
  • (3) Installing PEAR packages
  • (4) Configuring PHP5 and PEAR
  • (5) Creating the Symfony application
  • (6) Configuring an Apache virtual host
  • (7) Setting up the database and an initial front-end

The above steps cover the same areas as the first two days of the tutorial, and once you have completed this howto you should be able to follow along with the rest of the tutorial.

(1) Installing Smart

If you need packages that are not on your installation media, it is a good idea to install the Smart package management tool.

The current versions of the required packages are:

  • python-numeric-24.0-2
  • rpm-python-4.1.1-222
  • python-gtk-2.8.0-3
  • smart-0.41-22.guru.suse100
  • smart-gui-0.41-22.guru.suse100

If these are not on your installation media, they are available from:
http://download.opensuse.org/distribution/SL-10.0-OSS/inst-source/suse/i586
and:
http://ftp.skynet.be/pub/suser-guru/rpm/packages/System/smart/

Change to superuser, and install these with:

rpm -ivh *.rpm

Then run:

SuSEconfig

Launch Smart, and select File -> Update Channels. This may take a few minutes, but once it is complete you can then search (Ctrl+F) for the packages you want, and have them found, downloaded and installed automatically. Remember to run SuSEconfig manually after using Smart.

(2) Installing required SUSE 10.0 packages

Install:

  • apache2
  • php5 (and any modules, php5-*, you want - in particular, you are likely to want a database module, php5-pgsql, php5-sqlite, or php5-mysql) - the version used here is 5.0.4-9
  • php5-devel
  • php5-pear
  • automake
  • autoconf
  • bison
  • flex

(3) Installing PEAR packages

You have installed php5-pear, but you now need to upgrade it and add additional packages, including Symfony itself. On SUSE 10.0, the first thing to note is that you need to run pear5 (and not pear) to access PEAR, which is installed in /usr/share/php5/PEAR. The second thing is that you may have to run a few more commands to get things properly set up. The following list gives a quick reference.

pear5 upgrade PEAR

to upgrade the PEAR installation.

pear5 config-show

will show you the PEAR configuration for your system

pear5 config-help

gives a brief description of the meaning of each of the configuration parameters

pear5 help

lists the various commands

pear5 help shortcuts

lists abbreviations for the commands

pear5 help <command>

gives information on <command>

pear5 list

shows all the packages installed on the default channel (pear.php.net) To see packages installed from all channels, use:

pear5 list -allchannels
pear5 add-channel

add a new package channel

pear5 update-channels

updates all the channels you have set up

pear5 install --alldeps <package>

will install <package> and any other packages on which it depends

pear5 upgrade --alldeps <package>

will upgrade <package> and any other packages on which it depends

pear5 config_get preferred_state

The default is for PEAR to install only those packages marked as stable, as the above will show. However, you may need to install a package (or a dependency) that is in alpha or beta. To do this, run:

pear5 config-set preferred_state alpha

or

pear5 config-set preferred_state beta

Note that this setting only applies in the terminal you are using. If you open a new terminal and check preferred_state, you will see that it is back at the default "stable".

pecl install <package>

attempts to install PECL packages (such as Xdebug). However, this always gave the message:

ERROR: `phpize' failed

This is mentioned on some mailing-lists, and the root cause seems to be a bug. The result is that installing PECL packages seems to be impossible for the moment. If anyone has a fix for this, I'd be happy to hear it.

Once all the required updates are complete, you can install Symfony as per the instructions in the Askeet tutorial. First, you need to increase the the maximum allowed memory under PHP, or you will get an error (PHP Fatal error: Allowed memory size of 8388608 bytes exhausted ....) on the install. As root, run:

pico /etc/php5/cli/php.ini

and in the Resource Limits section, change:

memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)

to:

memory_limit = 20M      ; Maximum amount of memory a script may consume (20MB)

For good measure, do the same with /etc/php5/apache2/php.ini, and then restart Apache:

rcapache2 restart

To install Symfony, run:

pear5 channel-discover pear.symfony-project.com

to set up the new channel, and then:

pear5 install symfony/symfony-beta

Then run:

pear5 install http://phing.info/pear/phing-current.tgz

to install Phing. You can then also install a few optional PEAR packages for Phing as well, if desired.

My initial roster of PEAR packages before this process was:

Archive_Tar 1.1 stable
Console_Getopt 1.2 stable
HTML_Template_IT 1.1 stable
Net_UserAgent_Detect 2.0.1 stable
PEAR 1.3.5 stable
XML_RPC 1.2.2 stable

After upgrading and installing required PEAR packages and their dependencies, and the Symfony packages, I had:

Installed packages, channel pear.php.net:

Package Version State
Archive_Tar 1.3.1 stable
Benchmark 1.2.6 stable
Console_Getopt 1.2 stable
Console_Table 1.0.4 stable
DB 1.7.6 stable
HTML_Template_IT 1.1.4 stable
Log 1.9.5 stable
MDB2 2.0.1 stable
Net_UserAgent_Detect 2.2.0 stable
PEAR 1.4.9 stable
PEAR_PackageFileManager 1.5.2 stable
PHPUnit2 2.3.5 stable
PHP_CompatInfo 1.0.0 stable
PhpDocumentor 1.3.0RC6 beta
VersionControl?_SVN 0.3.0alpha1 alpha
XML_Beautifier 1.1 stable
XML_Parser 1.2.7 stable
XML_RPC 1.4.8 stable
XML_Tree 1.1 stable
XML_Util 1.1.1 stable
phing 2.1.1 stable

Installed packages, channel pear.symfony-project.com:

Package Version State
pake 1.0.93 stable
symfony 0.7.1320 beta

(4) Configuring PHP5 and PEAR

The PHP5 directory on SUSE 10.0 is called php5, so to prevent any problems with scripts expecting php, create that directory and symlink it to php5:

ln -s /usr/bin/php5 /usr/bin/php

In order for various PEAR packages and files to be found, we need to set up the PEAR path to be included in the PHP search path. Run:

pico /etc/php5/cli/php.ini

and in the Paths and Directories section, change:

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path = "/usr/share/php5"

to:

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path = "/usr/share/php5:/usr/share/php5/PEAR:/remaster/kevindata/sfprojects/askeet"

Note that the include paths seem to be incorrectly returned if you uncomment the first include_path line and enter the directories there, so use the version here.

You can also take this opportunity to include the path to your project (/remaster/kevindata/sfprojects/askeet above) - this is needed in order to prevent errors later in the build process. You will (presumably) have to do this for each subsequent project.

For good measure, do the same with /etc/php5/apache2/php.ini, and then restart Apache:

rcapache2 restart

(5) Creating the Symfony application

Running:

symfony -V

will give:

symfony version 0.7.1320

Set up a project in the location you chose earlier:

mkdir /remaster/kevindata/sfprojects/askeet
cd /remaster/kevindata/sfprojects/askeet
symfony init-project askeet

Run:

symfony init-app frontend

to create the frontend application.

(6) Configuring an Apache virtual host

The setup in Using multiple symfony projects is preferable to the one in the tutorial. This approach uses the localhost range (127.0.0), but takes advantage of the fact that there is more than one available address in that range. This makes it easier to run multiple Symfony projects from a simple URL.

As root, run:

pico /etc/apache2/vhosts.d/askeet.conf

and enter the following text:

<VirtualHost 127.0.0.2:80>
 ServerName askeet
 DocumentRoot "/remaster/kevindata/sfprojects/askeet/web"
 DirectoryIndex index.php
 Alias /sf /usr/share/php5/PEAR/data/symfony/web/sf
 <Directory "/remaster/kevindata/sfprojects/askeet/web">
  AllowOverride All
  Allow from All
 </Directory>
</VirtualHost>

You can change

Allow from All

to

Allow from 192.168.0

(or similar) if you want to limit the machines that can connect. Save this, and then add the line:

127.0.0.2		askeet

to /etc/hosts as in the tutorial.

Restart Apache with:

rcapache2 restart

Going to http://askeet shows the Congratulations page. If you do not get this, go through the above instructions and make sure you have not made a typo.

(7) Setting up the database and an initial front-end

Edit /config/schema.xml as in the tutorial. Note: do not be tempted to cut and paste the contents from the website - this is likely to embed stray characters that will mean the build-model and build-sql commands below will not work properly. Then run:

symfony propel-build-schema

(You will get an error message about MySQL access, but that can be ignored at this stage.)

Then run:

symfony propel-build-model

Create the MySQL database and edit askeet/config/databases.yml as set out in the tutorial. Then run:

symfony propel-build-sql

Run:

mysql -uroot -p askeet < data/sql/schema.sql

to configure the MySQL database.

Run:

symfony propel-generate-crud frontend question Question

to create the question module, and then run:

symfony cc frontend config

to clear the cache. (Remember to clear the cache each time you add a new class.)

This brings us to the end of day 2 of the Askeet tutorial, and you should now be able to follow along with the rest of the tutorial.

resume writer writer [resume writer] [writer] [[resume writer>>http://cvresumewriters.com/]] <a href="http://cvresumewriters.com/">resume writer</a>