PHP exec : dirvish default error (23) -- partial transfer - php

I have web services that are used for backups, but since the move to PHP7 (?) The backup no longer works.
All web services links work.
I isolated the code that is a problem in PHP 7 but it can come from something else!
<?php
//$outputShell=shell_exec('sudo cat /etc/passwd');
exec('sudo /usr/sbin/dirvish --vault L106',$outputShell, $codeErreur);
//exec('sudo cat /etc/passwd',$outputShell, $codeErreur);
//
if ($codeErreur == 0){
var_dump ("ok",$outputShell,$codeErreur);
}
else{
var_dump ("nook",$outputShell,$codeErreur);
}
?>
When I execute this code directly via a browser I have this error:
dirvish error: branch /san/pcdsi/L106:default image 20190221154124
failed dirvish L106:default error (23) -- partial transfer expr:
syntax error expr: non-integer argument dirvish error: branch
/san/pcdsi/L106:default image 20190221154136 failed
and log dirvish
rsync_error: * Execution cycle 0 rsync: change_dir
"/mnt/pc-backup/L106/Users/" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous
errors) (code 23) at main.c(1668) [Receiver=3.1.2] rsync: [Receiver]
write error: Broken pipe (32) Execution cycle 1 * rsync:
change_dir "/mnt/pc-backup/L106/Users/" failed: No such file or
directory (2) rsync error: some files/attrs were not transferred (see
previous errors) (code 23) at main.c(1668) [Receiver=3.1.2] rsync:
[Receiver] write error: Broken pipe (32)
If I run the / usr / sbin / dirvish --vault L106 command in root, the backup is done without any problem !!
In addition the part in a comment that I tested via cat / etc / passwd works!
Of course, I checked the rights sudo and the script being launched via a browser www-data is sudo without password ... no problem on this side there
On my old PHP 5 server, this PHP code works!
Do you have an idea? I hold?
- system problem?
- PHP problem?
- dirvish problem on PHP 7 platform?
In short, the exec command ('sudo / usr / sbin / dirvish --vault L106', $ outputShell, $ errorCode); works in PHP 5 and not in PHP 7!!

Related

Error in setting up Laravel sail with docker

Working on setup for a php class, and I keep running into an error when trying to setup the example windows laravel app from the docs (https://laravel.com/docs/9.x/installation#getting-started-on-windows). After entering:
curl -s https://laravel.build/example-app | bash
I get the following error:
Processing fstab with mount -a failed.
<3>WSL (17) ERROR: CreateProcessEntryCommon:358: getpwuid(0) failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:362: getpwuid(0) failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:570: execvpe /bin/bash failed 2
<3>WSL (17) ERROR: CreateProcessEntryCommon:579: Create process not expected to return
As far as I know, I have docker and wsl2 installed correctly so I am unsure as to what is causing this error. I have Ubuntu installed as well, but unless I misunderstood the docs, I should just be able to punch the curl straight into cmd prompt to build it in the desired directory.

Heroku Worker Caching

I'm having trouble getting my worker process to update in Heroku. I have a worker dyno set in my Procfile that is connected to a Redis instance; I cannot see changes that I make to this file after deploying.
I've tried:
Resetting the dyno using heroku ps:restart worker.1 -a [appname]
Restarting all dynos using heroku ps:restart -a [appname]
Changing the contents of the file so the size is different
Changing the Procfile to point to a different PHP file
Nothing works. It looks like it picked up some of my changes overnight (maybe during reboot?) but I can't force it to pick up the changes... any ideas?
Logs to the rescue... I had an issue with my required include file paths, which was causing the build to fail. It was defaulting to the last successful build, which is why it looked like it was caching.
I was able to find this by watching the logs during the build:
heroku[worker.1]: Starting process with command `php bin/worker.php`
heroku[worker.1]: State changed from starting to up
heroku[worker.1]: Process exited with status 255
app[worker.1]: PHP Warning: require_once(../vendor/autoload.php): failed to open stream: No such file or directory in /app/bin/worker.php on line 9
app[worker.1]: PHP Fatal error: require_once(): Failed opening required '../vendor/autoload.php' (include_path='.:/app/.heroku/php/lib/php') in /app/bin/worker.php on line 9
heroku[worker.1]: State changed from up to crashed
Once I solved the build errors it no longer 'cached' and everything worked properly.
The include path that worked:
require_once(__DIR__ . '/../vendor/autoload.php');

Unable to capture changes to log file via nagios check_logwarn plugin command invoked via PHP exec() triggered via Jenkins

I am using nagios check_logwarn to capture changes to log files.
In order to test my setup, I have been manually adding the following log line to the concerned log file -
[Mon Mar 20 14:24:31 2017] [hphp] [12082:7f238d3ff700:32:000001] []
\nFatal error: entire web request took longer than 10 seconds and timed out in /var/cake_1.2.0.6311-beta
app/webroot/openx/www/delivery/postGetAd.php on line 483
The above should get caught by the following nagios command, because it contains the keyword "Fatal"
/usr/local/nagios/libexec/check_logwarn -d /tmp/logwarn_hiphop_error -p /mnt/log/hiphop/error_`(date +'%Y%m%d')`.log "^.*Fatal*"
Output (as expected) -
Log errors: \nFatal error: entire web request took longer than 10 seconds and timed out in /var/cake_1.2.
0.6311-beta
\nFatal error: entire web request took longer than 10 seconds and timed out in /var/cake_1.2.0.6311-beta
Running this command directly works (case 1), but it seems invoking the same via a PHP exec which is triggered via a Jenkins project is not catching the same (case 2).
Following is the PHP code of case 2 -
$errorLogCommand = '/usr/local/nagios/libexec/check_logwarn -d /tmp/logwarn_hiphop_error -p /mnt/log/hiphop/error_'.$date.'.log "^.*Fatal*"';
$output = exec($errorLogCommand);
file_put_contents('/var/cake_1.2.0.6311-beta/deployment/deployment.log', "\n ".date("Y-m-d H:i:s")." Checked error key words in error_".$date.".log. command -> ".$errorLogCommand, FILE_APPEND);
if($output!="OK: No log errors found")
{
file_put_contents('/var/cake_1.2.0.6311-beta/deployment/deployment.log', "\n ".date("Y-m-d H:i:s")." - Hiphop errors -> ".$output, FILE_APPEND);
$failure=true;
break;
}
else
{
file_put_contents('/var/cake_1.2.0.6311-beta/deployment/deployment.log', "\n ".date("Y-m-d H:i:s")." - No Error found -> ".$output, FILE_APPEND);
}
Following is the output -
2017-03-20 14:16:45 Checked error key words in error_20170320.log. command -> /usr/local/nagios/libexec/
check_logwarn -d /tmp/logwarn_hiphop_error -p /mnt/log/hiphop/error_20170320.log "Fatal"
2017-03-20 14:16:45 - No Error found -> OK: No log errors found
Note that with the same nagios command (/usr/local/nagios/libexec/check_logwarn) as in case 1, log error is not detected in this case, unexpectedly.
Following are my observations of the contents of the internal tracker file which nagios generates - /tmp/logwarn_hiphop_error/mnt_log_hiphop_error_20170320.log -
When error is detected in case 1, following are the changes in the file -
Before running command
# logwarn 1.0.10 state for "/mnt/log/hiphop/error_20170320.log"
INODENUM="1208110246"
LINENUM="110"
POSITION="111627"
MATCHING="true"
After running command
# logwarn 1.0.10 state for "/mnt/log/hiphop/error_20170320.log"
INODENUM="1208110246"
LINENUM="116"
POSITION="112087"
MATCHING="false"
Also, following are the changes to the same file in case 2 -
Before running php file
# logwarn 1.0.10 state for "/mnt/log/hiphop/error_20170320.log"
INODENUM="1208110246"
LINENUM="102"
POSITION="109329"
MATCHING="true"
After
# logwarn 1.0.10 state for "/mnt/log/hiphop/error_20170320.log"
INODENUM="1208110246"
LINENUM="110"
POSITION="111627"
MATCHING="true"
I am not sure why the MATCHING parameter is true in the case 2, whereas in case 1 it is false. In fact, the error matching happened in case 1.
Update
I tried wrapping the command in an escapeshellcmd, to ensure that the regex is not being stripped out -
$output = exec(escapeshellcmd($errorLogCommand));
but still no change in output.
Update 2
Found that I had line breaks in the log line I was manually adding. Removing those fixed it consistently for the case of running the PHP file from command line. However, the problem is still reproducible consistently for the case 2, where I am triggering the project via Jenkins and this file gets called in one of the hooks of AWS code deploy.
Well, it seems this is not going to get solved so easily. The problem got fixed for manual invocation of the PHP file, but on invocation via Jenkins, I am still getting the same problem consistently.
The logwarn documentation mentions support for a negative checking expression.
Please try pre-pending an exclamation mark (!) before the pattern string to exclude rather than include these matches

Magento patch failing to install

When downloading and running the Magento PHP 5.4 support patch (Magento-CE-v1.7.0.0-1.7.0.2) from http://www.magentocommerce.com/download, running the script using sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh we receive this error:
$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
: command not found_1.12.0.0_v1.sh: line 7:
'ATCH_SUPEE-2629_EE_1.12.0.0_v1.sh: line 9: syntax error near unexpected token `{
'ATCH_SUPEE-2629_EE_1.12.0.0_v1.sh: line 9: `_check_installed_tools() {
Strangely, line 7 of the script is blank (here's the head of the file):
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""
We tried the download in Windows and Mac, in Firefox and Chrome to rule out any encoding problems caused by the download process. The patch seems to be very new - Added Jan 17, 2014
We're running Magento Community Edition 1.7.0.2
Edit
We've tried running the .sh file with bash as well but receive the same response.
Interestingly when the click "download", Magento shows the .sh source in the browser so we tried various combinations of view-source then save; copying the text from the browser window and saving it to a text file. None of these solved the problem although one changed the error message to:
$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
Checking if patch can be applied/reverted successfully...
/usr/bin/patch: **** malformed patch at line 238:
ERROR: Patch can't be applied/reverted successfully.
Line 238 is the blank comment line here:
+/**
+ * Abstract helper class for {#link Zend_Pdf_FileParser} that provides the
+ * data source for parsing.
+ *
+ * Concrete subclasses allow for parsing of in-memory, filesystem, and other
+ * sources through a common API. These subclasses also take care of error
+ * handling and other mundane tasks.
We also tried the VI step mentioned here - :set ff unix
http://www.magentocommerce.com/boards/viewthread/864518
The error then changed to:
$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.
patching file app/code/core/Mage/Catalog/Model/Product.php
Hunk #1 FAILED at 1936.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Catalog/Model/Product.php.rej
patching file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php.rej
patching file app/code/core/Mage/Install/etc/config.xml
patching file app/code/core/Zend/Pdf/FileParserDataSource.php
It turns out that this error is given when the patch file (not the file being patched) has line endings which do not match the system on which it is being run.
eg: You will see this error when:
You are running on Linux
Your patch file has Windows line endings
I changed the patch file to have Unix line endings using Sublime:
View > Line Endings > Unix
See also Error patching Magento 1.7.1 Hunk #1 Failed at

how to start zoneminder server

i install the zoneminder as per their instruction give by zone minder.After installation they gave a command to start zomeminder server
"zmpkg.pl start" but when i use this i got this error .
Warning, overriding installed ./zm.conf file with local copy
Bareword "ZM_PATH_LOGS" not allowed while "strict subs" in use at /usr/share/perl5/ZoneMinder/Debug.pm line 265.
Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 34.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 34.
Compilation failed in require at /usr/bin/zmpkg.pl line 45.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 45.
Zoneminder requires a web server and a background task:
service httpd start
service zoneminder start
From Start ZoneMinder
Look if there is something wrong with SQL dump import
In my case, in installation manual for Ubuntu 14.04 it is asked to import database dump with
MySQL -uroot -p < /usr/share/zoneminder/db/zm_create.sql
this failed and halted due to error with creation of 'Logs' table. I then edited the SQL file to add
DROP TABLE IF EXISTS `Logs`;
before
CREATE TABLE `Logs` (
and then imported the dump successfully. The zm service then started correctly without errors

Categories