smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.25k stars 705 forks source link

AlmaLinux 8, PHP 7.0 to 7.4 , Smarty 3.1.x Failing To Load Templates #873

Closed fergussoftware closed 1 year ago

fergussoftware commented 1 year ago

Dear Friend Please help with the following issue "AlmaLinux 8, PHP 7.0 to 7.4, Smarty 3.1.x Failing To Load Templates"

1) PHP Info is working fine 2) Core PHP working without any issue 3) AlmaLinux 9, PHP 8.1, and Smarty 4.x works fine.

But

"AlmaLinux 8, PHP 7.0 to 7.4 , Smarty 3.1.x Failing To Load Templates"

thanks Devang

wisskid commented 1 year ago

Can you provide a reproduction scenario? "Failing To Load Templates" is not a Smarty error that is known to me. In fact, it doesn't occur in the Smarty source code at all. Instead of a full reproduction scenario, a stack trace would be helpful as well.

fergussoftware commented 1 year ago

You can install AlmaLinux 8 on Intel Hardware with at least 4GB RAM. Install PHP 7.0 to PHP 7.4 any version either from RPM Package or compile it from source code downloaded from php.net. Install Smarty using Composer. Try to run the code provided under the demo folder. After making changes to index.php if needed. The demo code will not run. We installed the PHP from source code using following command sequence

Step 1: Install apache and apache devel libraries from rpm. Step 2: ./configure \ --prefix=/opt/php7 \ --with-freetype-dir \ --with-libxml-dir \ --with-curl \ --with-mcrypt \ --with-bz2 \ --with-zlib \ --with-mhash \ --with-pcre-regex \ --with-mysqli \ --with-png-dir=/usr \ --with-openssl \ --with-fpm-user=apache \ --with-fpm-group=apache \ --with-libdir=lib64 \ --with-gettext \ --with-gd \ --with-jpeg-dir=/usr/lib/ \ --with-apxs2 \ --with-xsl \ --with-readline \ --with-xmlrpc \ --with-gmp \ --with-pspell \ --enable-mbstring \ --disable-rpath \ --enable-soap \ --enable-calendar \ --enable-inline-optimization \ --enable-wddx \ --enable-ftp \ --enable-gd-native-ttf \ --enable-zip \ --enable-sockets \ --enable-sysvshm \ --enable-pcntl \ --enable-mbregex \ --enable-shmop \ --enable-exif \ --enable-sysvsem \ --enable-intl \ --enable-sysvmsg \ --enable-fpm \ --enable-bcmath

make make install

Step 3: Install using composer Go to WebRoot / DocumentRoot folder /opt/php7/bin/php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" /opt/php7/bin/php composer-setup.php install /opt/php7/bin/php composer.phar require smarty/smarty

Test demo code.

fergussoftware commented 1 year ago

Few more details

httpd -V

Server version: Apache/2.4.37 (AlmaLinux) Server built: Feb 21 2023 05:23:39 Server's Module Magic Number: 20120211:83 Server loaded: APR 1.6.3, APR-UTIL 1.6.1 Compiled using: APR 1.6.3, APR-UTIL 1.6.1 Architecture: 64-bit Server MPM: event threaded: yes (fixed thread count) forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"

httpd -M

Loaded Modules: core_module (static) so_module (static) http_module (static) access_compat_module (shared) actions_module (shared) alias_module (shared) allowmethods_module (shared) auth_basic_module (shared) auth_digest_module (shared) authn_anon_module (shared) authn_core_module (shared) authn_file_module (shared) authn_socache_module (shared) authz_core_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_owner_module (shared) authz_user_module (shared) autoindex_module (shared) data_module (shared) deflate_module (shared) dir_module (shared) dumpio_module (shared) echo_module (shared) env_module (shared) expires_module (shared) ext_filter_module (shared) filter_module (shared) headers_module (shared) include_module (shared) info_module (shared) log_config_module (shared) logio_module (shared) macro_module (shared) mime_magic_module (shared) mime_module (shared) negotiation_module (shared) remoteip_module (shared) reqtimeout_module (shared) request_module (shared) rewrite_module (shared) setenvif_module (shared) socache_shmcb_module (shared) status_module (shared) substitute_module (shared) suexec_module (shared) unique_id_module (shared) unixd_module (shared) version_module (shared) vhost_alias_module (shared) watchdog_module (shared) mpm_event_module (shared) ssl_module (shared) systemd_module (shared) php7_module (shared)

php -m [PHP Modules] bcmath bz2 calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext gmp hash iconv intl json libxml mbstring mcrypt mysqli mysqlnd openssl pcntl pcre PDO pdo_sqlite Phar posix pspell readline Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib

[Zend Modules]

ERROR

Notice: Undefined index: path in /allurez/libs/Smarty.class.php on line 1126

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1127

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1130

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1136

Notice: Undefined index: path in /allurez/libs/Smarty.class.php on line 1126

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1127

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1130

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1136

Notice: Undefined index: path in /allurez/libs/Smarty.class.php on line 1126

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1127

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1130

Notice: Undefined index: root in /allurez/libs/Smarty.class.php on line 1136

Fatal error: Uncaught --> Smarty: Unable to load template 'file:index.tpl' <-- thrown in /allurez/libs/sysplugins/smarty_internal_template.php on line 195

wisskid commented 1 year ago

Can't reproduce. In my case, the demo file runs just fine. In any case, please follow https://www.smarty.net/docs/en/installation.tpl for an actual installation.