Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Prestashop in FreeNas

Marcelo Ruiz

Oct 8, 2015
I finally got Prestashop in FreeNas. For those of you who are interested in doing this, I made a little tutorial:

Installing Prestashop in FreeNas

This tutorial will show how to install Prestashop 1.6 in FreeNas 9.3. This installation might not be for production use. My goal was to develop my website in a platform that will secure my data to later migrate it to a web hosting service.
Experienced FreeNas/FreeBSD users (I am a total noob) might know a way to optimize this process. Please make your suggestions.
This tutorial assumes you have a working FreeNas 9.3 installation. For ease of use I will install nano for editing files.

1 - Create the new Jail

Login to your FreeNas and select Jails -> Add Jail -> Advanced Mode. In the Jail name write 'prestashop', uncheck IPv4 DHCP, provide a manual IPv4 address that works with your network (in my case I will use but your network configuration my differ) and uncheck VIMAGE. Click OK and the new Jail will be created.
2 - Verify the Jail has Internet access

Select the prestashop Jail and click the the shell icon to open the web terminal. Once open type:​

If you get a response like the following, you have Internet access from within the Jail:​

PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=55 time=18.720 ms
64 bytes from icmp_seq=1 ttl=55 time=19.139 ms

Type Ctrl+C to stop the execution of the command and go to step 3.
If you don't get a response after a few seconds, type Ctrl+C to stop the execution and exit the terminal by typing:​


Select the prestashop Jail and click on the icon to Stop it. Confirm you want to stop it. Click on the icon to Edit the Jail and switch to Advanced Mode. You might need to re-configure the Jail following the instructions on step 1. Click the save button and repeat this step to ensure you have Internet access.​

3 - Configuring users

Change the root password by typing:​


The terminal will prompt for the password of the root user. Choose a password for the root user.
Create a new user by typing:​


Select psuser and the user name (you can choose another user but be sure to use your user instead in the following steps).
Follow the steps and provide the information required selecting defaults values until prompted to invite user into other groups. In this step enter:​


Continue with the steps to finish the user creation. Select a password for the user and finish the final configuration steps. When prompted for confirmation type 'yes' and respond 'no' when asked to add another user.​

4 - Configure the Jail for remote access

I like 'nano' as the text editor, so I will use that program (if you're more comfortable with 'vi' you can skip the command that installs 'nano' and use 'vi' in the rest of this tutorial).
In the terminal type the following commands one at the time:​

pkg update
pkg install nano

Confirm with 'Y' each time you're prompted to proceed with the action. After the installation finishes, configure the jail for remote access executing:

sed -i '' 's/sshd_enable="NO"/sshd_enable="YES"/' /etc/rc.conf

Select the Jail in the list of jails and click on the restart button.​

5 - Accessing the shell through an external terminal.

In a computer connected to the same LAN open your favorite terminal (in linux I use terminal) and try to connect to the prestashop Jail (replace user with the user name you want and the IP for the value you used for the IPv4 address in step 1) by typing:

ssh psuser@

Once you're logged in as psuser, we are going the change to the root user to install and configure the software.Type:


enter the password for the 'root' user you chose in step 3.
The prompt in the terminal will show you are the root user displaying before the cursor:

root@prestashop:/usr/home/psuser #
6 - Install the required software

Type the following command:

pkg install apache24 mysql56-server php56-extensions php56-mysql php56-mysqli php56-curl php56-simplexml php56-mcrypt php56-soap pecl-memcache mod_php56 prestashop

When prompted to proceed with the action, answer 'Y' and wait for the installation to finish.
7 - Configure apache

To set the server name with 'prestashop' execute the following command:

sed -i "" "s/#ServerName prestashop/" /usr/local/etc/apache24/httpd.conf

Next, create the prestashop configuration file with the following command:

nano /usr/local/etc/apache24/Includes/prestashop.conf

Once the editor opens, insert the following content into the blank document:

<VirtualHost *:80>
Alias /prestashop /usr/local/www/prestashop/
AcceptPathInfo On
<Directory /usr/local/www/prestashop>

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
ErrorLog /var/log/prestashop-error_log
CustomLog /var/log/prestashop-access_log common

Then apply the changes and save the file by pressing Ctrl+O followed by Enter. Exit the editor by pressing Ctrl+X
This configuration file make apache log errors to '/var/log/prestashop-error_log' and access logs to '/var/log/prestashop-access_log'
Finally, execute the following command:

sed -i "" "s/DirectoryIndex index.html/DirectoryIndex index.html index.htm index.php/" /usr/local/etc/apache24/httpd.conf
8 - Configure PHP

If you want to access meaninful errors and logs, configure PHP for development, executing in the terminal:

cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

Otherwise, use the production configuration by executing:

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Execute the following commands one by one:

sed -i "" "s/upload_max_filesize = 2M/upload_max_filesize = 16M/" /usr/local/etc/php.ini

sed -i "" "s/max_execution_time = 30/max_execution_time = 60/" /usr/local/etc/php.ini

echo 'magic_quotes_gpc = Off' >> /usr/local/etc/php.ini

echo 'register_globals = Off' >> /usr/local/etc/php.ini

Now create the php_mod.conf file by executing:

nano /usr/local/etc/apache24/Includes/php_mod.conf

In the blank file that opens add the following:

<FilesMatch "\.php$">
SetHandler application/x-httpd-php
<FilesMatch "\.phps$">

SetHandler application/x-httpd-php-source

Press Ctrl+O followed by Enter to write the new file. Press Ctrl+X to exit nano.

The following step will help troubleshooting the installation in case of errors.
Create a test PHP file that displays the information in a webpage by executing:

nano /usr/local/www/apache24/data/test.php

Once the blank file opens, insert the following:


The hit Ctrl+O followed by Enter to save the file and Ctrl+X to exit nano.​

9 - Configure Development Mode in Prestashop.

If you want Prestashop to report errors on the webpage, execute the following command:

sed -i "" "s/define('_PS_MODE_DEV_', false)/define('_PS_MODE_DEV_', true)/" /usr/local/www/prestashop/config/

10 - Enable mysql and apache services

Execute the following commands, one at a time:

echo 'apache24_enable="YES"' >> /etc/rc.conf

echo 'mysql_enable="YES"' >> /etc/rc.conf

11 - Create and configure the prestashop database

Start the mysql server by executing this command:

service mysql-server start

After that, enter into mysql as a root user by executing:

mysql -u root

Once executed, the prompt will reflect we are working within mysql by displaying:


The following commands are executed at the mysql prompt. Do not type 'mysql>' in them (I write the prompt just as a reference that indicates we are working in mysql). After a successful execution of the following commands, you will be returned to the 'mysql>' prompt after a message like the following: "Query OK, 0 rows affected (0.00 sec)". This message is the confirmation the command executed with no errors.

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootPassword');

Be sure to include the single quotes in the command.
You can replace 'rootPassword' for your own password.
Next, create de Prestashop Database and grant access to the prestashop user by executing the following commands one after the other:

mysql> CREATE DATABASE prestashop;

mysql> GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop'@'localhost' IDENTIFIED BY 'prestashopPassword' WITH GRANT OPTION;

Be sure to include the single quotes in the command.
You can replace 'prestashopPassword' for your own password. If you choose to do so, this is the password you will use in the initial Prestashop configuration.


mysql> quit

The last command will return us to the root prompt.​

12 - Start apache and verify there are no configuration errors

Start the apache server by running the following command:

service apache24 start

If the configuration was successful (and you did not make typos in the commands), you'll receive the following output:

Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.

If you receive errors, you'll get enough information for troubleshooting.
13 - Display PHP configuration in the browser

Open in your browser:

If you use a different IP address in step 1, use it instead of

This should display the PHP information in the browser. This information is useful for troubleshooting.
14 - Launch the Prestashop install

Open in your browser:

The browser should redirect you to:

Follow the installation steps until you're presented with the database configuration section.
Unless you changed the credentials while configuring MySQL server, you should use the following information to test the database connection:

Data server address: localhost

Database name: prestashop

Database login: prestashop

Database Password: prestashopPassword

Tables prefix: ps_

After entering the information, press the 'Test your database connection now!" button. You should get the following output:

Database is connected

Finish the installation.​

15 - Delete the install folder.

Once you receive the confirmation that the prestashop installation finished, execute the following command to delete the install folder and enable access to the backstore:

rm -r /usr/local/www/prestashop/install/

16 - Optionally rename the admin folder

Prestashop sets and admin folder with random characters that needs to be opened in the browser to access the backstore.
If you want to have an easier-to-remember admin folder (for example admin-prestashop) execute the following command:

mv /usr/local/www/prestashop/`ls /usr/local/www/prestashop | grep "admin"` /usr/local/www/prestashop/admin-prestashop

17 - Exit the terminal

After the installation was completed, exit from the root terminal by typing:


Finally exit the terminal executing the previous command again.​

You should have now a Prestashop instance installed in your FreeNas!