Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarty not found? #413

Open
PatH007 opened this issue Sep 11, 2024 · 22 comments
Open

Smarty not found? #413

PatH007 opened this issue Sep 11, 2024 · 22 comments

Comments

@PatH007
Copy link

PatH007 commented Sep 11, 2024

          Hi there.

Fatal error: Uncaught Error: Class "Smarty" not found in C:\wamp64\www\booking\lib\Email\SmartyEmail.php on line 9 Error: Class "Smarty" not found in C:\wamp64\www\booking\lib\Email\SmartyEmail.php on line 9

I got exactly the same kind of errors when I try to install the last app on a OVH shared server...
Fatal error: Uncaught Error: Class "Smarty" not found in /home/mywebsite/www/librebooking/lib/Email/SmartyEmail.php:9 Stack trace: #0 /home/mywebsite/www/librebooking/lib/Email/namespace.php(7): require_once() #1 /home/mywebsite/www/librebooking/lib/Email/Messages/AccountCreationEmail.php(3): require_once('/home/mywebsite...')

Thank for any help.

Originally posted by @PatH007 in #277 (comment)

@PatH007
Copy link
Author

PatH007 commented Sep 17, 2024

I tried on a different server, same error when I try to start /Web/install and no tables were created in the database...

@daj1u06
Copy link

daj1u06 commented Sep 18, 2024

Sounds like you haven't got Smary libraries.
The booking system has changed since twinkletoes software stopped developing booked scheduler. In particular, not all dependencies are included, so need to use composer to fetch them during the install.

This is for windows.

Install Composer
Download composer from https://getcomposer.org/
Runn Composer-Setup.exe v2.6.6 as admin, this installs composer such that it can be called from any directory (by adding to windows path).
Ran this as admin, install for all users. Selected C:\xamp\php\php.exe as the command line php to use (change for your back end)
Select add to path (wouldn’t continue without this checked), didn’t select a proxy
Installs OK
Online documentation is here https://getcomposer.org/doc/

Installing extra dependencies
Open xampp’s shell and navigate to C:\xampp\htdocs\my_libre_booking_folder
type "composer install (return)" in the shell
It should report sometthing like:

_```
_No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 10 installs, 0 updates, 0 removals

  • Locking google/recaptcha (1.2.4)
  • Locking gregwar/captcha (v1.2.1)
  • Locking kint-php/kint (4.2.3)
  • Locking monolog/monolog (2.9.2)
  • Locking phpcompatibility/php-compatibility (9.3.5)
  • Locking psr/log (3.0.0)
  • Locking smarty/smarty (v4.3.4)
  • Locking squizlabs/php_codesniffer (3.8.0)
  • Locking stripe/stripe-php (v10.21.0)
  • Locking symfony/finder (v7.0.0)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 10 installs, 0 updates, 0 removals
  • Downloading google/recaptcha (1.2.4)
  • Downloading symfony/finder (v7.0.0)
  • Downloading gregwar/captcha (v1.2.1)
  • Downloading kint-php/kint (4.2.3)
  • Downloading psr/log (3.0.0)
  • Downloading monolog/monolog (2.9.2)
  • Downloading squizlabs/php_codesniffer (3.8.0)
  • Downloading phpcompatibility/php-compatibility (9.3.5)
  • Downloading smarty/smarty (v4.3.4)
  • Downloading stripe/stripe-php (v10.21.0)
  • Installing google/recaptcha (1.2.4): Extracting archive
  • Installing symfony/finder (v7.0.0): Extracting archive
  • Installing gregwar/captcha (v1.2.1): Extracting archive
  • Installing kint-php/kint (4.2.3): Extracting archive
  • Installing psr/log (3.0.0): Extracting archive
  • Installing monolog/monolog (2.9.2): Extracting archive
  • Installing squizlabs/php_codesniffer (3.8.0): Extracting archive
  • Installing phpcompatibility/php-compatibility (9.3.5): Extracting archive
  • Installing smarty/smarty (v4.3.4): Extracting archive
  • Installing stripe/stripe-php (v10.21.0): Extracting archive
    15 package suggestions were added by new dependencies, use composer suggest to see details.
    Generating autoload files
    3 packages you are using are looking for funding.
    Use the composer fund command to find out more!_

Then try to install librebooking:

point browser to: http://localhost/my_libre_booking_folder/Web/install

and fingers crossed.

Hope this helps.

@PatH007
Copy link
Author

PatH007 commented Sep 19, 2024

Sounds like you haven't got Smary libraries. The booking system has changed since twinkletoes software stopped developing booked scheduler. In particular, not all dependencies are included, so need to use composer to fetch them during the install.

Thanks a lot for your help.
I finally achived to install Smarty on another server( not OVH...).
But I still have trouble with smarty... I don't know but it sound like paths trouble but I can't find where.

Fatal error: Uncaught Error: Class "Smarty" not found in /htdocs/mywebsite.com/librebooking/lib/Email/SmartyEmail.php:10 Stack trace: #0 /htdocs/mywebsite.com/librebooking/lib/Email/namespace.php(7): require_once() #1 /htdocs/mywebsite.com/librebooking/lib/Email/Messages/AccountCreationEmail.php(3): require_once('/htdocs/resa.pa...')..................

@treborin
Copy link
Contributor

Hi @PatH007,

Could you check if you have this folder: /htdocs/mywebsite.com/librebooking/vendor/smarty/smarty
If it is not there, you must open shell, cd to /htdocs/mywebsite.com/librebooking/ and write install composer

@PatH007
Copy link
Author

PatH007 commented Sep 19, 2024

Could you check if you have this folder: /htdocs/mywebsite.com/librebooking/vendor/smarty/smarty
Thank you for your help.
It is ok, the folder is at the right place.
Now never ending warning with Web/install instruction.

Warning: chmod(): No such file or directory in /htdocs/mywebsite.com/librebooking/Web/install/index.php on line 30
The web server (such as _www on Mac or apache on Linux) must have write access to /../../tpl_c.
Warning: fileperms(): stat failed for /../../tpl_c in /htdocs/resa.mywebsite.com/librebooking/Web/install/index.php on line 16

@PatH007
Copy link
Author

PatH007 commented Sep 19, 2024

It seems there is never ending problem with ROOTDIR (?).

@treborin
Copy link
Contributor

treborin commented Sep 19, 2024

@PatH007, that warning is about write access (0755) to /librebooking/tpl_c folder
Check that this folder exists and create it if it does not exists

@PatH007
Copy link
Author

PatH007 commented Sep 19, 2024

Thank you for your help.
Indeed, the folder exists and the access is set to 0755, I checked a few times.
Either I got that error of path (seems to be) or a smarty problem (however I finally achived to install it).

@treborin
Copy link
Contributor

@PatH007 , wich PHP version are you using?

@PatH007
Copy link
Author

PatH007 commented Sep 20, 2024

8.1.29 php version.

@PatH007
Copy link
Author

PatH007 commented Sep 20, 2024

Can't make it work.
Tried app 2.7 and again errors.
Fatal error: Uncaught Error: Call to a member function assign() on null in /htdocs/mywebsite.com/Pages/Page.php:227 Stack trace: #0 /htdocs/mywebsite.com/Pages/Page.php(156): Page->Set('ErrorMessage', 'UnknownError') #1 /htdocs/mywebsite.com/lib/Common/Logging/ExceptionHandler.php(56): Page->RedirectToError() #2 /htdocs/mywebsite.com/lib/Common/Logging/ExceptionHandler.php(37): WebExceptionHandler->HandleException(Object(TypeError)) #3 [internal function]: ExceptionHandler::Handle(Object(TypeError)) #4 {main} thrown in /htdocs/mywebsite.com/Pages/Page.php on line 227

@treborin
Copy link
Contributor

@PatH007 ,
Librebooking PHP8 support started from version 2.8.6, so 2.7 with PHP 8.1.29 wont work.
It seems to me that there is a path config issue in your first installl. Could you pls post here your config.php content?

@PatH007
Copy link
Author

PatH007 commented Sep 23, 2024

Thanks for your help.
`$conf['settings']['app.title'] = 'Reservation Tennis Thueyts';
$conf['settings']['default.timezone'] = 'Europe/Paris';
$conf['settings']['allow.self.registration'] = 'true'; // if users can register themselves
$conf['settings']['admin.email'] = '[email protected]'; // email address of admin user
$conf['settings']['admin.email.name'] = 'Tennis Reservation'; // name to be used in From: field when sending automatic emails
$conf['settings']['company.name'] = 'Tennis Thueyts'; // name of company, if applicable
$conf['settings']['company.url'] = 'http://resa.mywebsite.com/'; // URL of company, if applicable
$conf['settings']['default.page.size'] = '50'; // number of records per page
$conf['settings']['enable.email'] = 'true'; // global configuration to enable if any emails will be sent
$conf['settings']['default.language'] = 'fr_fr'; // find your language in the lang directory
$conf['settings']['script.url'] = 'http://resa.mywebsite.com/'; // public URL to the Web directory of this instance. this is the URL that appears when you are logging in. leave http: or https: off to auto-detect
$conf['settings']['image.upload.directory'] = 'Web/uploads/images'; // full or relative path to where images will be stored
$conf['settings']['image.upload.url'] = 'uploads/images'; // full or relative path to show uploaded images from
$conf['settings']['cache.templates'] = 'true'; // true recommended, caching template files helps web pages render faster
$conf['settings']['use.local.js.libs'] = 'false'; // false recommended, delivers jQuery from Google CDN, uses less bandwidth
$conf['settings']['registration.captcha.enabled'] = 'true'; // recommended. unless using recaptcha this requires php_gd2 enabled in php.ini
$conf['settings']['registration.require.email.activation'] = 'false'; // requires enable.email = true
$conf['settings']['registration.auto.subscribe.email'] = 'false'; // requires enable.email = true
$conf['settings']['registration.notify.admin'] = 'false'; // whether the registration of a new user sends an email to the admin (ala phpScheduleIt 1.2)
$conf['settings']['inactivity.timeout'] = '30'; // minutes before the user is automatically logged out
$conf['settings']['name.format'] = '{first} {last}'; // display format when showing user names
$conf['settings']['css.extension.file'] = ''; // full or relative url to an additional css file to include. this can be used to override the default style
$conf['settings']['disable.password.reset'] = 'false'; // if the password reset functionality should be disabled
$conf['settings']['home.url'] = ''; // the url to open when the logo is clicked
$conf['settings']['logout.url'] = ''; // the url to be directed to after logging out
$conf['settings']['default.homepage'] = '1'; // the default homepage to use when new users register (1 = Dashboard, 2 = Schedule, 3 = My Calendar, 4 = Resource Calendar)

$conf['settings']['schedule']['use.per.user.colors'] = 'false'; // color reservations by user
$conf['settings']['schedule']['show.inaccessible.resources'] = 'false'; // whether or not resources that are inaccessible to the user are visible
$conf['settings']['schedule']['reservation.label'] = '{name}'; // format for what to display on the reservation slot label. Available properties are: {name}, {title}, {description}, {email}, {phone}, {organization}, {position}, {startdate}, {enddate} {resourcename} {participants} {invitees} {reservationAttributes}. Custom attributes can be added using att with the attribute id. For example {att1}
$conf['settings']['schedule']['hide.blocked.periods'] = 'false'; // if blocked periods should be hidden or shown

$conf['settings']['ics']['subscription.key'] = ''; // must be set to allow webcal subscriptions
$conf['settings']['privacy']['view.schedules'] = 'true'; // if unauthenticated users can view schedules
$conf['settings']['privacy']['view.reservations'] = 'false'; // if unauthenticated users can view reservations
$conf['settings']['privacy']['hide.user.details'] = 'false'; // if personal user details should be displayed to non-administrators
$conf['settings']['privacy']['hide.reservation.details'] = 'false'; // if reservation details should be displayed to non-administrators. options are true, false, current, future, past
$conf['settings']['privacy']['allow.guest.reservations'] = 'false'; // if reservations can be made by users without a Booked account, if true this overrides schedule and resource visibility
$conf['settings']['reservation']['start.time.constraint'] = 'future'; // when reservations can be created or edited. options are future, current, none
$conf['settings']['reservation']['updates.require.approval'] = 'false'; // if updates to previously approved reservations require approval again
$conf['settings']['reservation']['prevent.participation'] = 'false'; // if participation and invitation options should be removed
$conf['settings']['reservation']['prevent.recurrence'] = 'false'; // if recurring reservations are disabled for non-administrators
$conf['settings']['reservation']['enable.reminders'] = 'false'; // if reminders are enabled. this requires email to be enabled and the reminder job to be configured
$conf['settings']['reservation']['allow.guest.participation'] = 'false';
$conf['settings']['reservation']['allow.wait.list'] = 'false';
$conf['settings']['reservation']['checkin.minutes.prior'] = '5';
$conf['settings']['reservation']['default.start.reminder'] = ''; // the default start reservation reminder. format is ## interval. for example, 10 minutes, 2 hours, 6 days.
$conf['settings']['reservation']['default.end.reminder'] = ''; // the default end reservation reminder. format is ## interval. for example, 10 minutes, 2 hours, 6 days.
$conf['settings']['reservation']['title.required'] = 'false';
$conf['settings']['reservation']['description.required'] = 'false';

$conf['settings']['reservation.notify']['resource.admin.add'] = 'false';
$conf['settings']['reservation.notify']['resource.admin.update'] = 'false';
$conf['settings']['reservation.notify']['resource.admin.delete'] = 'false';
$conf['settings']['reservation.notify']['resource.admin.approval'] = 'false';
$conf['settings']['reservation.notify']['application.admin.add'] = 'false';
$conf['settings']['reservation.notify']['application.admin.update'] = 'false';
$conf['settings']['reservation.notify']['application.admin.delete'] = 'false';
$conf['settings']['reservation.notify']['application.admin.approval'] = 'false';
$conf['settings']['reservation.notify']['group.admin.add'] = 'false';
$conf['settings']['reservation.notify']['group.admin.update'] = 'false';
$conf['settings']['reservation.notify']['group.admin.delete'] = 'false';
$conf['settings']['reservation.notify']['group.admin.approval'] = 'false';

$conf['settings']['uploads']['enable.reservation.attachments'] = 'false'; // if reservation attachments can be uploaded
$conf['settings']['uploads']['reservation.attachment.path'] = 'uploads/reservation'; // full or relative (to the root of your installation) filesystem path to store reservation attachments
$conf['settings']['uploads']['reservation.attachment.extensions'] = 'txt,jpg,gif,png,doc,docx,pdf,xls,xlsx,ppt,pptx,csv'; // comma separated list of file extensions that users are allowed to attach. leave empty to allow all extensions

$conf['settings']['database']['type'] = 'mysql';
$conf['settings']['database']['user'] = 'patri1343698'; // database user with permission to the booked database
$conf['settings']['database']['password'] = 'mypass';
$conf['settings']['database']['hostspec'] = '185.98.131.109'; // ip, dns or named pipe
$conf['settings']['database']['name'] = 'patri1343698_47sz4m';

$conf['settings']['phpmailer']['mailer'] = 'mail'; // options are 'mail', 'smtp' or 'sendmail'
$conf['settings']['phpmailer']['smtp.host'] = ''; // 'smtp.company.com'
$conf['settings']['phpmailer']['smtp.port'] = '25';
$conf['settings']['phpmailer']['smtp.secure'] = ''; // options are '', 'ssl' or 'tls'
$conf['settings']['phpmailer']['smtp.auth'] = 'true'; // options are 'true' or 'false'
$conf['settings']['phpmailer']['smtp.username'] = '';
$conf['settings']['phpmailer']['smtp.password'] = '';
$conf['settings']['phpmailer']['sendmail.path'] = '/usr/sbin/sendmail';
$conf['settings']['phpmailer']['smtp.debug'] = 'false';

$conf['settings']['plugins']['Authentication'] = '';
$conf['settings']['plugins']['Authorization'] = '';
$conf['settings']['plugins']['Permission'] = '';
$conf['settings']['plugins']['PostRegistration'] = '';
$conf['settings']['plugins']['PreReservation'] = '';
$conf['settings']['plugins']['PostReservation'] = '';

$conf['settings']['install.password'] = '';

$conf['settings']['pages']['enable.configuration'] = 'true';

$conf['settings']['api']['enabled'] = 'false';

$conf['settings']['recaptcha']['enabled'] = 'false';
$conf['settings']['recaptcha']['public.key'] = '';
$conf['settings']['recaptcha']['private.key'] = '';

$conf['settings']['email']['default.from.address'] = '';
$conf['settings']['email']['default.from.name'] = '';

$conf['settings']['reports']['allow.all.users'] = 'false';

$conf['settings']['password']['minimum.letters'] = '6';
$conf['settings']['password']['minimum.numbers'] = '0';
$conf['settings']['password']['upper.and.lower'] = 'false';

$conf['settings']['reservation.labels']['ics.summary'] = '{title}';
$conf['settings']['reservation.labels']['ics.my.summary'] = '{title}';
$conf['settings']['reservation.labels']['rss.description'] = '

Start {startdate}
End {enddate}
Organizer {name}
Description {description}
';
$conf['settings']['reservation.labels']['my.calendar'] = '{resourcename} {title}';
$conf['settings']['reservation.labels']['resource.calendar'] = '{name}';
$conf['settings']['reservation.labels']['reservation.popup'] = ''; // Format for what to display in reservation popups. Possible values: {name} {dates} {title} {resources} {participants} {accessories} {description} {attributes} {pending} {duration}. Custom attributes can be added using att with the attribute id. For example {att1}

$conf['settings']['security']['security.headers'] = 'false'; // Enable the following options
$conf['settings']['security']['security.strict-transport'] = 'true';
$conf['settings']['security']['security.x-frame'] = 'deny';
$conf['settings']['security']['security.x-xss'] = '1; mode=block';
$conf['settings']['security']['security.x-content-type'] = 'nosniff';
$conf['settings']['security']['security.content-security-policy'] = ""; // Requires careful tuning (know what your doing)

$conf['settings']['google.analytics']['tracking.id'] = ''; // if set, Google Analytics tracking code will be added to every page in Booked

$conf['settings']['authentication']['allow.facebook.login'] = 'true';
$conf['settings']['authentication']['allow.google.login'] = 'true';
$conf['settings']['authentication']['required.email.domains'] = '';
$conf['settings']['authentication']['hide.booked.login.prompt'] = 'false';
$conf['settings']['authentication']['captcha.on.login'] = 'false';

$conf['settings']['credits']['enabled'] = 'false';
$conf['settings']['credits']['allow.purchase'] = 'false';

$conf['settings']['slack']['token'] = '';`

@treborin
Copy link
Contributor

Hi @PatH007,

Pls. try this:
Change this line $conf['settings']['script.url'] = 'http://resa.mywebsite.com/';
with this: $conf['settings']['script.url'] = 'resa.mywebsite.com/librebooking/Web';

@PatH007
Copy link
Author

PatH007 commented Sep 24, 2024

Thank you @treborin for your help.
I made the change but no difference.
Fatal error: Uncaught Error: Call to a member function assign() on null in /htdocs/resa.mywebsite.com/Pages/Page.php:227 Stack trace: #0 /htdocs/resa.mywebsite.com/Pages/Page.php(156): Page->Set('ErrorMessage', 'UnknownError') #1 /htdocs/resa.mywebsite.com/lib/Common/Logging/ExceptionH..................
The whole app has to be in folder /librebooking/ or it doesn't matter if the parameters are ok ?

@treborin
Copy link
Contributor

You can install on root, no problem.
Pls, try $conf['settings']['script.url'] = 'http:';

Are you able to use the error logging. It'd help to see the log file

/**
 * Error logging
 */
$conf['settings']['logging']['folder'] = '/htdocs/log'; //Absolute path to folder were the log will be written, writing permissions to the folder are required
$conf['settings']['logging']['level'] = 'debug'; //Set to none disable logs, error to only log errors or debug to log all messages to the app.log file 
$conf['settings']['logging']['sql'] = 'false'; //Set to true no enable the creation of and sql.log file

@PatH007
Copy link
Author

PatH007 commented Sep 25, 2024

Thanks a lot again for your help.
I made all modifications in config.php and created a log folder (permission 777), a couple of tests and nothing appeared in that log folder.
However I could access to log offered by hoster.
Date : 25/09/2024 14:41:28 Requête : /Web/? Code HTTP : 200 Referer : Aucun User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0 Erreur : AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function assign() on null in /htdocs/resa.website.com/Pages/Page.php:227\nStack trace:\n#0 /htdocs/resa.website.com/Pages/Page.php(156): Page->Set('ErrorMessage', 'UnknownError')\n#1 /htdocs/resa.website.com/lib/Common/Logging/ExceptionHandler.php(56): Page->RedirectToError()\n#2 /htdocs/resa.website.com/lib/Common/Logging/ExceptionHandler.php(37): WebExceptionHandler->HandleException(Object(TypeError))\n#3 [internal function]: ExceptionHandler::Handle(Object(TypeError))\n#4 {main}\n thrown in /htdocs/resa.website.com/Pages/Page.php on line 227'

@daj1u06
Copy link

daj1u06 commented Sep 25, 2024 via email

@treborin
Copy link
Contributor

HI @PatH007 ,
I think there is something wrong with your Smarty install.

Line 227 refers to a smarty function:
image

Try to run composer install. Do it on local, if you cant do it on hoster and then upload the vendor folder again

@PatH007
Copy link
Author

PatH007 commented Oct 9, 2024

Thanks for your help all.
But no way to make any change...

@effgarces
Copy link
Collaborator

It seems that you are downloading the repo, in this case as treborin says you need to do composer install to add all the needed libraries. Could you try using the latest released zip?

@l3th0n
Copy link

l3th0n commented Oct 15, 2024

I experienced the same error in the /var/log/apache2/error.log.
I installed Composer and ran (as said above) composer install. Had to use root priviliges though because of JsonFile.php.
image
And the /Web/install works now
Was on stable btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants