Smarty

     

    NOTE: This guide uses /opt/bitnami to refer to the installation directory for the Bitnami Stack. This is the default installation directory for Bitnami Cloud Hosting, Google Cloud Platform and Microsoft Azure servers and for virtual servers. If you're using a native installer and have installed the Bitnami Stack to a different folder, replace /opt/bitnami in the examples below with your actual installation directory.

    Overview

    The Smarty framework is installed in the frameworks/smarty directory of the installation directory. This folder 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. Select your platform below.

    Bitnami Cloud Hosting

    Access the example application via your browser at http://[server-IP-address]/smarty

    Microsoft Azure / Google Cloud Platform

    Access the example application via your browser at http://[server-IP-address]/smarty

    Virtual Machine

    Access the example application via your browser at http://[virtual-server-IP-address]/smarty

    Native Installer

    Access the example application via your browser at http://localhost/smarty (Windows) or http://localhost:8080/smarty (Mac OS X and Linux).

    Tabs end

    Here is an example of what you might see:

     

    smarty-1.png

    To enable the second example application, 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"
    

    Then, edit the /opt/bitnami/frameworks/smarty/conf/httpd-app.conf file and modify the <Directory> 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
    

    Then, 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-2.png

    Upgrading Smarty 3.x

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

    NOTE: The steps below assume that you have already activated the Smarty example application, as described here.
    1. Log in to your server console.
    2. If you are using a native installer only, load the Bitnami environment:
      $ cd /opt/bitnami
      $ ./use_lampstack
      
    3. Back up the current version of Smarty:
      $ cd /opt/bitnami/frameworks
      $ sudo mv smarty smarty.old
      
    4. 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
      
    5. 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/
      
    6. 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-upgrade.png

    More Information

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

    Tag page (Edit tags)
    • No tags
    Pages that link here
    Page statistics
    139557 view(s), 11 edit(s) and 6547 character(s)

    Comments

    You must login to post a comment.