Jump to content
#StayAtHome ×

PatRoy

Members
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About PatRoy

  • Rank
    Member
  1. It's a fairly old NAS... (DLink DNS325). I've installed Fonz Fun_plug (ffp) 0.7 on it a while back now: https://nas-tweaks.net/398/installing-and-uninstalling-packages-in-fonz-fun_plug-0-7/ uname reads: Linux datahub 2.6.31.8 #8 Tue Jun 26 11:38:41 CST 2012 armv5tel GNU/Linux I do have a package manager from the FFP installation named 'slacker' or 'funpkg'... but can't see anything in there in regards of locale* ... In short, ffp installs to /ffp. Apps, base system of it simply chroots into /ffp/... I do have 'locale' and 'localedef' on the main NAS OS in /usr/sbin/locale*, but no charmaps, to create the locales with that localedef. Tried copying the files from my ArchLinux install /usr/share/i18n/* and symlink them on my NAS in /usr/share/i18n/: ln -s /ffp/usr/share/i18n/ /usr/share then force a creation of the locale fr_FR: localedef -v -c -i fr_FR -f UTF-8 fr_FR.UTF-8 but for one thing, I'm getting a bunch of warnings such as: and finally, at the end get a : Info on this locale-archive: root@datahub:~# ll /usr/lib/locale/locale-archive lrwxrwxrwx 1 root root 44 Mar 28 23:18 /usr/lib/locale/locale-archive -> /usr/local/modules/web/config/locale-archive root@datahub:~# mount | grep /usr/local/modules /usr/local/tmp/image.cfs on /usr/local/modules type squashfs (rw,loop=/dev/loop0) Even though it says 'rw' in my mount options, I can't write to that FS... That's pretty much all the info I've got and tried p.s.: if I cant do anything with gettext, any way I could temporarily use something like XMLs, JSONs etc? I was thinking of writing a Locale class that would accept a boolean say "useGettext" in the constructor... If it's set, then simply return gettext's value when calling Locale::myGettext("Some string"); if it's NOT set, then my Locale::myGettext would fetch data in an XML /JSON or what ever else approach... All my code in my pages would use something like: Locale::myGettext("Some string"); Locale::mynGettext("You have one mail", "You have %d" mails", $totalMail); Is this approach stupid ? I would prefer just using gettext()... Thanks again for your help
  2. Found the solution by putting website on another server : turns out I need to install my desired website locales (fr_FR, nl_NL) on my server with locale-gen. Works on an ArchLinux box, but tool doesn't exist on my real server (a NAS). I have a 'localedef' on my NAS to help generate locales, but my NAS is missing all requirements for this it seems under /usr/share/i18n/ ... I'm lost here... Any advice on an alternative to gettext ?
  3. Hello again, So, after messing around with gettext, and having found the solution to my previous post (https://forums.phpfreaks.com/topic/310383-gettext-for-multilangual-not-working-for-me/), I've come to the conclusion that I need to use something else than gettext in order to make my site multilingual. Problem I have with gettext is that I absolutely need to have my desired languages (i.e. fr_FR, nl_NL, etc) installed on my server's system (in my case, a NAS for now). I can see which locales I have on my server with 'locale -a'. I am in no way able to install new locales on my NAS. It's too limited... too much locked down. So, I'm looking for an alternative to gettext. Any suggestions for me perhaps ? Thanks for any advice. Pat
  4. Hello folks, So, trying to create a multilingual website using gettext. Now, just the simplest examples doesn't seem to work for me. I've loaded gettext.so in my php.ini (see http://corbeauperdu.ddns.net/phpinfo.php) and created a PO / MO pair with POEdit. My MO/PO file reads: msgid "" msgstr "" "Project-Id-Version: Prestadesk\n" "POT-Creation-Date: 2020-03-26 21:08+0100\n" "PO-Revision-Date: 2020-03-27 07:59+0100\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.3\n" "X-Poedit-Basepath: ../../../..\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Poedit-SourceCharset: UTF-8\n" "Last-Translator: \n" "Language: fr\n" "X-Poedit-SearchPath-0: .\n" #: templates/prestadesk_dashboard.php:41 #, php-format msgid "Welcome, %s!" msgstr "Bienvenu, %s!" #: templates/prestadesk_dashboard.php:42 msgid "This page will show the dashboard" msgstr "Cette page affichera le tableau de bord" It's located under <DOC_ROOT>/prestadesk/include/locales/fr/LC_MESSAGES/prestadesk.po And I've got this very simple php test page under <DOC_ROOT>/prestadesk/templates/prestadesk_dashboard.php <?php $lang='fr'; $domain = 'prestadesk'; $codeset = 'UTF-8'; $locales_dir = '../include/locales'; // need to go up on directory from here to get into the include/locales // here we define the global system locale given the found language putenv('LANG='.$lang); // this might be useful for date functions (LC_TIME) or money formatting (LC_MONETARY), for instance setlocale(LC_ALL, $lang); // this will make Gettext look for $locales_dir/<lang>/LC_MESSAGES/prestadesk.mo bindtextdomain($domain, $locales_dir); // indicates in what encoding the file should be read bind_textdomain_codeset($domain, $codeset); // here we indicate the default domain the gettext() calls will respond to textdomain($domain); // test translate echo gettext("This page will show the dashboard"); ?> Nothing happens. No translation, no errors... I just see the message in English Any ideas for me ? Thanks a bunch!
  5. Arghh stupid me ! Of course... you made me realise all I have to do is assign a css class say "hideme" to my columns TD/TH's I want hidden on phones, and have my stylesheet do something like: @media only screen and (max-width: 767.98px){ .hideme{ display: none; } } Something like that should do it. Thanks for your help again :) Pat
  6. Hello folks, So, not sure where to start, but I'm wondering if it's at all possible to change a prepared statement / sql based on whether or not we're displaying for desktops, or for smartphone/tablets? I'm not sure what to start looking at since I'm pretty new in PHP and all... I've managed to figure out how to change CSS if I'm on phone @media only screen and (max-width: 767.98px){ // PUT CSS FOR PHONES... } Any directions on how I would change my SQL, would be awesome! I'd like to narrow down the columns returned if I'm on phone, otherwise breaks my pages looks too much... Much thanks in advance! Pat
  7. Thanks. I had to escape 3 times the backslach afterall : preg_replace("/\w+\\\/", "", $str); Cheers for your help
  8. Hello, I'm sure my error isn't much, but I can't seem to remove part of a string... This is an example string: Stack trace: #0 /mnt/HD/HD_a2/DATA/WWW/html/calchom/include/CorbeauPerdu/Database/DBWrapperStatement.php(525): CorbeauPerdu\Database\DBWrapperStatement->_stmtCommitOnEachExec_HOTFIX() #1 /mnt/HD/HD_a2/DATA/WWW/html/calchom/include/CorbeauPerdu/Database/DBWrapperStatement.php(378): CorbeauPerdu\Database\DBWrapperStatement->_runMultiStatement(true) #2 /mnt/HD/HD_a2/DATA/WWW/html/calchom/include/CorbeauPerdu/Database/DBWrapper.php(773): CorbeauPerdu\Database\DBWrapperStatement->runStatement(false, true) #3 /mnt/HD/HD_a2/DATA/WWW/html/calchom/include/CorbeauPerdu/Database/DBWrapper.php(708): CorbeauPerdu\Database\DBWrapper->_storeDataEXE('INSERT INTO tbl...', Array, Array, true) #4 /mnt/HD/HD_a2/DATA/WWW/html/calchom/test.php(112): CorbeauPerdu\Database\DBWrapper->storeData('INSERT INTO tbl...', Array, Array, true, true) #5 {main} I want to remove, in this case, all instances of "CorbeauPerdu\Database\" . These could be other words of course... I tried the following regex in preg_replace(), which seems to work if I test in http://regex101.com/, but doesn't seem to work at all: $pattern = "/\w+\\\w+\\/"; echo "Fixed = ".preg_replace($pattern, "", $str); On top of that, my error log keeps telling me: Warning: preg_replace(): No ending delimiter '/' found ... Any ideas on what I'm doing wrong here? Much thanks Pat
  9. Just as an update, I haven't yet managed to upgrade my PHP on my NAS: it is pretty difficult to compile because of a series of problems, which leads to having to recompile other libs (i.e. wrong PCRE version), which leads to other problems... For now, I changed my code for that particular function so that it replaces my SQL ':variable' to the PDO::quote(values), and PDO::exec() instead of using bindParam. This way, I can keep my PDO::ATTR_EMULATE_PREPARES => FALSE, and it works... I don't like it, because it's a little slower, but don't have a choice for now
  10. It'll take me quite a bit of effort, cause I can't find packages for it for my NAS (it's running Fonz Fun_plug 0.7)... Kinda old, and VERY slow to compile on... I'll still see if I can manage to compile a newer version.. However, I doubt this is a PHP 7.1 issue (?), since I did manage to install PHP 7.1.33 on my PC and my code is working fine there... I'll repost when / if I manage to still compile a newer php ...
  11. UPDATE: alrighty, I finally managed to get gdb working on my server. Here's the output of GDB : root@datahub:/mnt/HD/HD_a2/DATA/NAS_Core_Dumps# gdb /ffp/bin/php-cgi core-php-cgi.11576 GNU gdb (GDB) 7.3.1 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "armv5tel-unknown-linux-gnueabi". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /mnt/HD/HD_a2/ffp/bin/php-cgi...(no debugging symbols found)...done. [New LWP 11576] [Thread debugging using libthread_db enabled] Core was generated by `/ffp/bin/php-cgi test.php'. Program terminated with signal 11, Segmentation fault. #0 0x40d4c494 in pdo_mysql_stmt_param_hook () from /ffp/lib/php/modules/pdo_mysql.so (gdb) bt #0 0x40d4c494 in pdo_mysql_stmt_param_hook () from /ffp/lib/php/modules/pdo_mysql.so #1 0x000ce55c in ?? () Cannot access memory at address 0x0 #2 0x000ce55c in ?? () Cannot access memory at address 0x0 Backtrace stopped: previous frame identical to this frame (corrupt stack?) Not sure what to think about this backtrace line... "Backtrace stopped: previous frame identical to this frame (corrupt stack?)". I don't really understand it all... Thanks again for your help guys
  12. Okay, I see what you mean about the autocommit... I tried as you said, essentially either remove the ATTR_AUTOCOMMIT => false, or I tried setting it to TRUE also.. I've kept only the $stmt->execute() in my loop, removing the beginTransaction() and commit(), but no luck.... I'm still getting a segfault / http 500 error It really is just the "ATTR_EMULATE_PREPARES => FALSE" causing this segfault... I've managed to get PHP 7.1.33 on my working PC, although not quite the same as on my server (7.1.4), and still working on PC.... I'm very puzzled here....
  13. Hey Barand, All valid points, but none that'll help my problem out To answer you... Okay for the autocommit attribute.. though it doesn't change anything in my case.. Here's the thing: I WANT to commit on every inserts! I already have another function as you said and did, but I want to be able to have a choice to commit on every row of data, and if one fails, just populate an array of failed ones, and keep on trying the remaining data... It's a very "generic" DB Wrapper I've written, which I'll hope to use in other projects. Doing it JUST like you did, if one fails, then everything is rolled back.. For the passwords... yep I know this... but it was for code clarity Thanks
  14. Just as a FYI, I got gdb-7.3.1 installed from a package for my NAS, but when trying to run it with the coredump, I get the following: root@datahub:/mnt/HD/HD_a2/DATA/NAS_Core_Dumps# gdb /ffp/bin/php-cgi core-php-cgi.12447 GNU gdb (GDB) 7.3.1 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-ffp-linux-uclibcgnueabi". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /mnt/HD/HD_a2/ffp/bin/php-cgi...I'm sorry, Dave, I can't do that. Symbol format `elf32-littlearm' unknown. .... But, that's beyond the scope of this post... Trying to build another gdb from source for now..
  15. Thanks for your reply. Okay, I managed to get the coredump, but I'm still trying really hard to get gdb installed and working properly on my NAS server... No luck yet, but working on it. Meanwhile, digging deeper, I did find exactly what was causing the segfault. It's my PDO Attribute: PDO::ATTR_EMULATE_PREPARES => false If I set this to TRUE, then it works... Now, this is an issue for me, since I'm using this to protect against SQL injections... Any ideas ? P.s.: as soon as I can get gdb working properly, I'll re-post trace... Is there any way I can just submit the coredump somewhere, or do I absolutely need to 'gdb php-cgi corefile' ? Thanks again.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.