Skip to main content

All Questions

Tagged with
0 votes
1 answer
47 views

How I can run a php inline script and also provide command line arguments using bash?

I try to make a simple script that pings a network connection: #!/usr/bin/env bash # Xdebug ip detector for docker # Copyright (C) 2023 Dimitrios Desyllas # # This program is free software: you can ...
Dimitrios Desyllas's user avatar
-1 votes
2 answers
130 views

How I could check connectivity in shell using an oneliner command without using netcat?

In a docker image I want to avoid installing netcat in order to ping for db connectivity at my entrypoint script: /bin/sh MOODLE_DB_HOST="xxxx" MOODLE_DB_PORT=80 function pingdb { OK=0 ...
Dimitrios Desyllas's user avatar
0 votes
0 answers
516 views

Securely run shell command using php from another server

I've got Server A where the main website is hosted. I've got a panel there that I'd like to safely run a shell command on Server B every time a new user joins in. I will basically create a new user on ...
Yamile's user avatar
  • 1
0 votes
3 answers
69 views

Quoting rules in a complex situation

When writing lines of code we sometimes need to consider escaping some characters. I have come across a situation that I cannot answer on my own In PHP, the exec command requires a string enclosed in ...
Luca Zappi's user avatar
1 vote
0 answers
3k views

How to run a bash script from PHP

I have below php file to run a bash script... <?php $old_path = getcwd(); chdir('/home/scripts/'); $var = escapeshellarg("PC7"); $output = shell_exec("./Script2....
edublog's user avatar
  • 93
1 vote
1 answer
782 views

PPA not listing all available php packages

I have added the corresponding PPA: sudo add-apt-repository ppa:ondrej/php I have run sudo apt update But it's only showing candidates for php7.4 sudo apt install -y php8.0 produces E: Couldn't find ...
Borjante's user avatar
  • 113
0 votes
0 answers
242 views

Why shell_exec returns different response than bash terminal?

I'm running this code in php: shell_exec("cat /proc/mounts | grep \"^/dev\" | grep -v loop"); and it returns /dev/sda5 / ext4 rw,relatime,errors=remount-ro 0 0 /dev/sda1 /boot/efi ...
Lucas César's user avatar
-1 votes
5 answers
227 views

Reducing HDD seek time in reading the contents of many files in bash [closed]

I read millions of files in subdirectories of /XX/XX/XX/ to process the content of each file. In PHP, I read the files as foreach(glob("/folder/*") as $a){ foreach(glob("$a/*") ...
Googlebot's user avatar
  • 1,959
1 vote
4 answers
1k views

Parallel execution of remote commands

The setup: I have a PHP script (currently written for PHP5.5, but the server it runs from has 7.4) that processes files that contain lists of linux servers, then runs a bash or perl script via ssh on ...
solenoid's user avatar
  • 131
2 votes
3 answers
3k views

arguments limit php exec() to bash script

Testing how long will it take to pass 50000 arguments from php to a bash script, turns that I cannot pass even 1000 arguments from php to a bash script at once, unless I can? PHP: $array = ...
dwt.bar's user avatar
  • 145
1 vote
1 answer
228 views

Issues with bash script containing exigrep command when invoked from PHP webpage

I have a bash script to extract information from exim_mainlog. When the bash script is run from a putty command line (logged in as root), the extracted data is properly written to an output file. ...
Mike A's user avatar
  • 11
0 votes
1 answer
610 views

“sudo ls -a1 /home” Permission Denied

I have a php script that will run exec("bash /path/to/list.sh $dir", $out); The contents of list.sh are... #!/bin/bash sudo /usr/bin/ls -a1 $@ 2>&1 I have given apache permission to run ls ...
Ruthacury's user avatar
0 votes
0 answers
856 views

bash script curl upload files to php page

I am not sure that I am posting on the correct forum. I am working with Linux Centos 7 and I write a bash script which take all files with txt extension from a directory to upload them to the server ...
user979974's user avatar
2 votes
1 answer
409 views

Who is eating data? Xargs?

I am trying to parse a recursive directory of PHP files using the built in PHP linter, which works like this: $ php -l good.php No syntax errors detected in good.php $ php -l bad.php PHP Parse error:...
dotancohen's user avatar
  • 16.4k
0 votes
1 answer
48 views

Installing Composer dependency manager and running it right afterwards

I install Composer the PHP dependency manager and run it right afterwards this way on Ubuntu 18.04 with Bash: curl -sS https://getcomposer.org/installer -o composer-setup.php php composer-setup.php --...
user avatar

15 30 50 per page