azurelapp

Get started with Smarty

Overview

The Smarty framework is installed in the frameworks/smarty directory of the installation directory. This directory includes two example applications, located in the sample/ and demo/ directories respectively.

Activation and Testing

To enable the example application, edit the Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf and uncomment the following line

Include "/opt/bitnami/frameworks/smarty/conf/httpd-prefix.conf"

Then, restart the Apache server.

$ sudo /opt/bitnami/ctlscript.sh restart apache

You can now verify that the example application is working by visiting its URL using your browser at http://SERVER-IP/smarty.

Here is an example of what you might see:

Smarty welcome page

To enable the second example application, follow these steps:

  • Edit the Apache configuration file at /opt/bitnami/frameworks/smarty/conf/httpd-prefix.conf and modify it to point to the demo/ directory, as shown below:

    Alias /smarty/ "/opt/bitnami/frameworks/smarty/demo/"
    Alias /smarty "/opt/bitnami/frameworks/smarty/demo"
    Include "/opt/bitnami/frameworks/smarty/conf/httpd-app.conf"
    
  • Edit the /opt/bitnami/frameworks/smarty/conf/httpd-app.conf file and modify the directive to reflect the new path:

    <Directory "/opt/bitnami/frameworks/smarty/demo">
    ...
    </Directory>
    
  • You should also modify the permissions and ownership of the demo/ directory so that it is writable by the Web server user:

    $ cd /opt/bitnami/frameworks/smarty
    $ sudo chown -R bitnami:daemon demo
    $ sudo chmod -R 775 demo
    
  • Restart the Apache server.

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    

You can now verify that the second example application is working by visiting the same URL as before. Here is an example of what you should see.

Smarty welcome page

Upgrading Smarty 3.x

NOTE: The steps below assume that you have already activated the Smarty example application.

If you would like to upgrade to the latest Smarty version, follow these steps:

  • Log in to your server console.

  • Back up the current version of Smarty:

    $ cd /opt/bitnami/frameworks
    $ sudo mv smarty smarty.old
    
  • Download and install the latest version of Smarty (3.1.27 at the time of writing):

    $ cd /opt/bitnami/frameworks
    $ sudo wget https://github.com/smarty-php/smarty/archive/v3.1.27.zip
    $ sudo unzip v3.1.27.zip
    $ sudo mv smarty-3.1.27 smarty
    
  • Copy the necessary configuration files from the previous Smarty installation:

    $ sudo cp -R /opt/bitnami/frameworks/smarty.old/conf /opt/bitnami/frameworks/smarty/
    $ sudo cp -R /opt/bitnami/frameworks/smarty.old/sample /opt/bitnami/frameworks/smarty/
    
  • Change file ownerships of the Smarty directory:

    $ cd /opt/bitnami/frameworks/
    $ sudo chown -R bitnami:root smarty
    $ cd /opt/bitnami/frameworks/smarty
    $ sudo chown -R bitnami:daemon sample
    $ sudo chmod -R 775 sample
    

You should now be able to access the sample application, as shown below:

Smarty welcome page

More Information

Learn more about developing applications with Smarty at http://www.smarty.net/quick_install.

Last modification May 9, 2019