Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/25/2020 in all areas

  1. With older symfony apps there is the concept of environments. Symfony used to come with a seperate controller for 3 environments (prod [production], dev [development] and test [unit tests]). So I would expect that you are configured as production, which means that your app is running the app_prod.php front controller. This will be setup to operate in the same way that apache will often be configured to run by default an index.php file if you access a webspace path directly as in http://www.somesite.test/. With Mautic, things have been configured to run the app_dev.php frontcontroller for every application request. The other thing you have to understand is that symfony generates lots of code, which is what actually gets run. This involves twig templates, doctrine models, routes and lots more stuff. Symfony comes with a console app that has various command that let you generate this code, however, it may be that the apache user doesn't have effective read perms on the files the OS user generated. So my simple fix would be to do this: -have script delete the entire app/cache/* contents recursively, which your bash command list does. Prior to doing this you might want to explore the contents of that dir. You will have a directory for any environments that ran, which I would expect ideally would only be a prod directory. As you can see in the logs you showed, the runtime is trying to access some doctrine orm model proxies that couldn't be opened. Assuming this is the issue, once you delete the directory, open the Mautic app. This will cause all the code generation to kick in and all these files and directories will be owned by the effective web user. That user does need the ability to read/write/execute in the app/cache directory. It might take a few seconds for all the code generation to occur as you are essentially "warming the cache" manually, but once the files are generated they won't be generated again and everything should run at full speed. You could also add your own web function that would clear the cache from the web app, but if the web app is in a situation where it doesn't actually own the directory and/or files in question, there is no way for that user to fix anything once it's broken, and only the account that owns the files will be able to delete/chmod/chown them (or via root or sudo). Assuming you deleted the app/cache/prod user, and ran the Mautuc app, you shouldn't encounter any problems. Not knowing what came with Mautic, it could be that there are scripts being run on some schedule that undo the issue you will be fixing, but removing the app/cache/prod directory should fix the problem.
    1 point
  2. Hi Tony, Is this a symfony app? Are you getting incorrect ownership due to running command line as an OS user? My first suggestion is to stop doing that, as it's guaranteed to mess up your ownership in this type of scenario. I'm not seeing why you need ssh whatsoever. A bash or php script would do the job. Look at the various exec and related commands. I would have to question why you don't simply cron your bash script and run it every 5 minutes. Much simpler and less invasive. Write the script, put it in /usr/local/sbin or /usr/local/bin. sudo su - {appropriate user to run script}. crontab -e. Add an entry to run at the periodicity you desire. I don't know that you want to blindly delete the app/cache dir contents every 5 minutes if you don't have to. Bash is a relatively full programming language where you can do standard if-then-else logic. With that said, you can also write a command line php script and invoke it in a cron exactly as you would a bash script. Or you can call the php command line scripts from bash. None of these ideas require ssh, and I don't really see what you need to run this remotely for if you have it running under cron automatically for you. If you are convinced you need remote execution, you could exec a script from a php page, but of course that will run as the OS user, and if you need sudo to correct some problems, you certainly wouldn't expect the apache user to have either a shell or su or sudo. A sysadmin/Devops person would turn to Anisible or Puppet for on demand controlled execution and administration of a cluster of servers, vpc's or what have you, but Ansible could work for you as well. Of course it might not be possible for you to install these tools in a shared hosting situation.
    1 point
  3. You need to set a few attributes when you create your PDO connection. $conn = new PDO("mysql:host=$servername;dbname=timeclock", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); Then you will be notified of any sql problems. Did you read my edit to earlier post about subtracting 1 day from the dates (to get Sun - Thu working week)?
    1 point
  4. I thought you might be able manage that bit. Here's a fuller version <?php $month = 'March'; $start_date = new DateTime("first monday of $month"); $incr = DateInterval::createFromDateString('next weekday'); $period = new DatePeriod($start_date, $incr, new DateTime()); // create temporary date table $conn->exec("CREATE TEMPORARY TABLE date (date date not null primary key)"); // populate it foreach ($period as $d) { $dates[] = "('{$d->format('Y-m-d')}')" ; } $conn->exec("INSERT INTO date VALUES " . join(',', $dates)); // now get the days absent $res = $conn->query("SELECT s.oracleid , s.name , date_format(date, '%W %d/%m/%Y') as absent FROM attendance_staff s CROSS JOIN date d LEFT JOIN attendance_record a ON s.oracleid = a.oracleid AND d.date = DATE(a.clockingindate) WHERE a.oracleid IS NULL ORDER BY s.oracleid, d.date "); $tdata = ''; foreach ($res as $r) { $tdata .= "<tr><td>" . join('</td><td>', $r) . "</td></tr>\n"; } ?> <html> <head> <title>Example</title> <style type="text/css"> table { border-collapse: collapse; width: 600px; } th, td { padding: 8px; } th { background-color: black; color: white; } </style> </head> <body> <table border='1'> <tr><th>ID</th><th>Name</th><th>Absent</th></tr> <?=$tdata?> </table> </body> </html>
    1 point
  5. https://www.php.net/manual/en/book.ssh2.php
    1 point
  6. My 0.02 worth... Why are you "denormalizing" your data by creating several objects all with the same id and color code. Would it not be more sensible (and a lot easier) to create a merged data set like this... <PRODUCTINFORMATION> <PRODUCTS> <PRODUCT> <PRODUCT_NUMBER>53-03</PRODUCT_NUMBER> <PRODUCT_PRINT_ID>42</PRODUCT_PRINT_ID> <PRODUCT_NAME>ProductFirst</PRODUCT_NAME> <COLOR_CODE>03</COLOR_CODE> <PRINTING_POSITION> <ID>TOP BOX</ID> </PRINTING_POSITION> <PRINTING_TECHNIQUES> <PRINTING_TECHNIQUE> <ID>DL</ID> </PRINTING_TECHNIQUE> <PRINTING_TECHNIQUE> <ID>L2</ID> </PRINTING_TECHNIQUE> <PRINTING_TECHNIQUE> <ID>P4</ID> </PRINTING_TECHNIQUE> </PRINTING_TECHNIQUES> </PRODUCT> </PRODUCTS> </PRODUCTINFORMATION> Below is my solution to your original quest using SimpleXML. Hava a go at it on your own as requinix suggested first then peek only if you really get stuck
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.