Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
4
votes
2
answers
1913
views
"not a valid package archive" when trying to install PHP extension?
I'm running CENTOS 6.6 on a VPS and am trying to install [the ZMQ PHP extension][1] and tried installing using the command shown in the instructions: sudo pecl install zmq-beta However, it fails, showing this as the output: root@host [/zmq]# sudo pecl install zmq-beta downloading zmq-1.1.2.tgz ... S...
I'm running CENTOS 6.6 on a VPS and am trying to install the ZMQ PHP extension and tried installing using the command shown in the instructions:
sudo pecl install zmq-beta
However, it fails, showing this as the output:
root@host [/zmq]# sudo pecl install zmq-beta
downloading zmq-1.1.2.tgz ...
Starting to download zmq-1.1.2.tgz (39,573 bytes)
..........done: 39,573 bytes
could not extract the package.xml file from "/root/tmp/pear/cache/zmq-1.1.2.tgz"
Download of "pecl/zmq" succeeded, but it is not a valid package archive
Error: cannot download "pecl/zmq"
Download failed
install failed
I also tried:
sudo pecl install -Z zmq-beta
And:
sudo pecl install --nocompress zmq-beta
But I get the same error.
Why is this error occuring?
Nate
(241 rep)
Jan 31, 2015, 09:45 PM
• Last activity: Aug 4, 2025, 10:01 AM
0
votes
1
answers
2537
views
upgrade to php 8.* version on centos 7.9
I have a Centos 7.9 with PHP 7.4.33 pre installed. followed this command steps for upgrading the php version to 8.1: sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum install -y yum-utils sudo yum-config-manager --enable remi-php81 sudo yum-config-manager --disable...
I have a Centos 7.9 with PHP 7.4.33 pre installed. followed this command steps for upgrading the php version to 8.1:
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum install -y yum-utils
sudo yum-config-manager --enable remi-php81
sudo yum-config-manager --disable remi-php74
sudo yum install -y php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
but at the end it returns:
No package php available.
No package php-common available.
No package php-opcache available.
No package php-mcrypt available.
No package php-cli available.
No package php-gd available.
No package php-curl available.
No package php-mysqlnd available.
Error: Nothing to do
retried with this:
yum --disablerepo="*" --enablerepo="remi-php81" list available
got same return. also tried:
sudo yum clean all
sudo yum update
and:
sudo yum install -y php81 php81-common php81-opcache php81-cli php81-gd php81-curl php81-mysqlnd
Same... .
what should i do?
---------
Update:
I have a Cpanel WHM on this server. in php version manager, i was able to change the version to 8. But what I want is 8.1 and it is not among the options.
Pooya Behravesh
(101 rep)
Apr 3, 2023, 02:54 PM
• Last activity: Aug 3, 2025, 04:08 AM
0
votes
0
answers
25
views
Apache force transfer-encoding chunked after update to version 2.4.62
I'm running Apache with PHP-FPM on a RHEL 9 server. After updating Apache from version 2.4.57 to 2.4.62, all HTTP responses now include the T**ransfer-Encoding: chunked** header, even when the PHP script explicitly sets the Content-Length header. I haven't made any changes to the Apache or PHP confi...
I'm running Apache with PHP-FPM on a RHEL 9 server. After updating Apache from version 2.4.57 to 2.4.62, all HTTP responses now include the T**ransfer-Encoding: chunked** header, even when the PHP script explicitly sets the Content-Length header.
I haven't made any changes to the Apache or PHP configuration files. Here’s a simple PHP script I used to test the response behavior. When I run this on Apache 2.4.57, it works correctly and the response includes the **Content-Length** header. However, the same PHP script on Apache 2.4.62 results in a response with the **Transfer-Encoding: chunked** header instead.
true]);
header("Content-length: ".strlen($response));
header("Content-type: application/json");
echo($response);
?>
Here is my site conf file
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule status_module modules/mod_status.so
Listen 443
ServerAdmin admin@smartySSL.com
DocumentRoot /var/www/smarty
SSLEngine On
SSLOptions +StrictRequire
SSLProtocol +TLSv1.2 -TLSv1.1 -TLSv1 -SSLv3
SSLCipherSuite HIGH:!MEDIUM:!LOW:!NULL:!aNULL:!MD5:!RC4
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
KeepAliveTimeout 10
SetEnvIf Request_URI ".*" no-gzip
SetEnv proxy-sendcl
LogLevel proxy:trace6
TraceEnable Off
Options -Indexes
# Proxy declaration
# we must declare a parameter in here (doesn't matter which) or
# it'll not register the proxy ahead of time
ProxySet disablereuse=off
# Note: If you configure php-fpm to use the "pm = ondemand"
#then use "ProxySet disablereuse=on"
SetHandler proxy:fcgi://php-fpm
SetEnv proxy-sendcl 1
LogLevel debug
ErrorLog logs/smartySSL.com-error.log
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{Connection}i\" %k" my_combined
CustomLog logs/smartySSL.com-access.log my_combined
Alias /prodTest /var/www/prod_testing_smarty
#disabilita il listing
Options -Indexes
Require ip 127.0.0.1
SetHandler server-status
Allow from 127.0.0.1
Allow from ::1
Deny from all
Order Allow,Deny
Allow from 127.0.0.1
Allow from ::1
ProxyPass unix:/run/php-fpm/www.sock|fcgi://localhost/fpm-status
RewriteEngine on
RewriteRule ^/TcpWeb/rest/FWUpdate/(v[0-9]+)/([A-Z][0-9]+) /rest/get_fwUpdate.php?version=$1&id=$2&%{QUERY_STRING} [END]
RewriteCond %{QUERY_STRING} ^([^&]+)
RewriteRule ^/TcpWeb/rest/GetAll/(v[0-9]+)/([A-Z][0-9]+)/?$ /rest/get_all.php?version=$1&id=$2&%{QUERY_STRING} [END]
RewriteRule ^/TcpWeb/rest/PutAll/(v[0-9]+)/([A-Z][0-9]+) /rest/put_all.php?version=$1&id=$2 [END]
RewriteRule ^/TcpWeb/rest/DiagnosticLog/(v[0-9]+)/([A-Z][0-9]+) /rest/put_diagnosticLog.php?version=$1&id=$2 [END]
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* -[F]
I can't use **Transfer-Encoding: chunked** header since is not supported by our embedded devices.
Any ideas ? Thanks
Riccardo Crociani
(1 rep)
Jul 11, 2025, 06:33 AM
2
votes
2
answers
6811
views
Permissions on a mounted NFS share
I am trying to make a php script on a webserver write into a folder /data on a fileserver. Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers. I am sharing the folder /data on...
I am trying to make a php script on a webserver write into a folder /data on a fileserver.
Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers.
I am sharing the folder /data on the fileserver by adding
/data 192.168.20.6(rw,sync,no_subtree_check)
Mount the folder by
sudo mount 192.168.20.5:/data /mnt/data
Create a link to the webroot(does that makes sense at all?)
sudo ln -s /mnt/data /webroot/site1/share
Then I get this:
Warning: fopen(/webroot/site1/share/data/uploads/Fotoraum/Original/Bluehend/test.txt): failed to open stream: Permission denied
Where and how do I have to adjust permissions in a sane manner to allow the script to write into /data and its subfolders?
Thanks a lot!
mammal
(21 rep)
Sep 9, 2014, 09:20 PM
• Last activity: Jun 29, 2025, 11:04 AM
0
votes
2
answers
1957
views
Fedora - Nginx PHP-FPM - constantly changing FPM Socket to root
Apologies in advance if my terminology is not on par. So I've just setup my work dev machine successfully on Fedora Workstation with Nginx and multiple PHP versions (using Remi Collet's Software Collection). I have PHP-5.6.30 listening on Port 9056 and PHP-7.0.19 listening on Port 9070. This works p...
Apologies in advance if my terminology is not on par.
So I've just setup my work dev machine successfully on Fedora Workstation with Nginx and multiple PHP versions (using Remi Collet's Software Collection). I have PHP-5.6.30 listening on Port 9056 and PHP-7.0.19 listening on Port 9070. This works perfectly.
This morning I decided to try running both PHP instances using FPM Sockets, which initially worked until I restarted the PHP-FPM service (this resulted in a *502 Bad gateway* in the browser, and *(13) Permission Denied* error in the nginx error.log).
So using PHP5.6 as an example ... when I first started the
php56-php-fpm
service which generated /opt/remi/php56/root/var/run/php-fpm/www.sock
, I changed the generated www.sock
file's user and group to nginx:nginx
. After restarting php56-php-fpm
I learned that www.sock
was being reset to root:root
. Now granted I won't be restarting FPM constantly, but there must be a way to set some defaults on the .sock
file?? My fpm conf files looks like this:
- **/opt/remi/php56/root/etc/php-fpm.d/www.conf**: https://pastebin.com/EasyHyEs
- **/etc/opt/remi/php70/php-fpm.d/www.conf**: https://pastebin.com/dhT8AEJK
- **/etc/nginx/nginx.conf**: https://pastebin.com/tMuAFnGM
- **/etc/nginx/conf.d/default.conf**: https://pastebin.com/UjkrcaYw
I realise that this sounds like a pain to get working correctly, considering that I am just doing this for local development, ***and*** that I did have this all working correctly using ports 9056 & 9070. But I've read that there are some speed benefits using sockets versus TCP, and anything that would speed up my local dev environment is worth making the effort for.
So my questions:
1. What in my config is incorrect that is causing www.sock to be reset to root:root
after restarting the respective FPM service?
2. Is it really worth moving away from ports in favour of sockets?
3. [slightly off-topic]: using Remi Collet's software collection, I see that the 2 PHP packages install to different locations: /opt/remi/php56
and /etc/opt/remi/php70
... for the purpose of consistency, should I consider moving either one of these into a more common location?
Thank you
maGz
(993 rep)
May 25, 2017, 12:23 PM
• Last activity: Jun 27, 2025, 12:04 PM
0
votes
2
answers
1991
views
Install PHP 8.0 Yaml extension on Ubuntu 18.04
I wrote a simple php based on the fisrt example. https://www.php.net/manual/es/function.yaml-parse.php I got... ```bash Fatal error: Uncaught Error: Call to undefined function yaml_parse() in /var/www/html/p.php:33 Stack trace: #0 {main} thrown in /var/www/html/p.php on line 33 ``` I use ondrej repo...
I wrote a simple php based on the fisrt example.
https://www.php.net/manual/es/function.yaml-parse.php
I got...
Fatal error: Uncaught Error: Call to undefined function yaml_parse() in /var/www/html/p.php:33 Stack trace: #0 {main} thrown in /var/www/html/p.php on line 33
I use ondrej repository to install php.
root@hidra:~# cat /etc/apt/sources.list.d/ondrej-ubuntu-php-bionic.list
deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
deb-src http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
There is no package to install yaml extension.
apt-file search phpize
apt-file search php8.0-yaml
apt-file search php8.2-yaml
Ok, let's try to compile it with phpize.
There is not phpize either or php8.0-dev (In debian phpize ussualy is there)
root@hidra:~# apt-get install php8.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php8.0-dev
E: Couldn't find any package by glob 'php8.0-dev'
E: Couldn't find any package by regex 'php8.0-dev'
I tried with Ubuntu 22.04 too. The ondrej have no php8.x-dev php8.x-yaml. And php-dev o php-yaml try to install php7.2 versions.
Besides, ymal code on PECL requires php 7.
What would be the proper way to install it in these circumstances?
I have used https://github.com/dallgoot/yaml to solve it, but I have curiosity with this issue.
icalvete
(101 rep)
Nov 15, 2023, 08:45 PM
• Last activity: Jun 25, 2025, 08:07 PM
0
votes
0
answers
58
views
What countermeasures are required for alert /var/lib/clamav/rfxn.yara: Php.Exploit.C99-27 FOUND?
Running ClamAV on my Linux Mint laptop gives /var/lib/clamav/rfxn.yara: Php.Exploit.C99-27 FOUND What does it mean on a laptop (not a server as such)? Is the system infected?
Running ClamAV on my Linux Mint laptop gives
/var/lib/clamav/rfxn.yara: Php.Exploit.C99-27 FOUND
What does it mean on a laptop (not a server as such)?
Is the system infected?
Mark Watney
(101 rep)
Jun 25, 2025, 05:15 AM
• Last activity: Jun 25, 2025, 02:11 PM
1
votes
2
answers
1883
views
php drop down menu to execute script with argument
I have shell script which I run like this /var/www/test.sh 2015 or /var/www/test.sh 2014 When this script runs, it actually takes data from freeradius and generates gnuplot base graph for the specific year in the www folder like /var/www/output.jpg Now I want to make a php drop down menu with years...
I have shell script which I run like this
/var/www/test.sh 2015
or
/var/www/test.sh 2014
When this script runs, it actually takes data from freeradius and generates gnuplot base graph for the specific year in the www folder like
/var/www/output.jpg
Now I want to make a php drop down menu with years like 2015, 2014 and so on, and when user select any year, it should run the script with the specific choice year. ***But how can I pass year to the shell script.***
so far I have tried this but its not working.
root@rm:/var/www# cat test5.php
some title
" />
root@rm:/var/www#
Syed Jahanzaib
(297 rep)
Jun 17, 2015, 05:27 AM
• Last activity: Jun 23, 2025, 12:01 PM
-1
votes
2
answers
147
views
PHP-FPM status page returns curl: (56) Recv failure
I have `PHP-FPM` pool with such configuration blocks: ... listen = 0.0.0.0:9000 ... pm.status_path = /status ... I'm getting curl: (56) Recv failure: Connection reset by peer while trying curl 0.0.0.0:9000/status . `PHP-FPM` instance I try to interact with is containerized and `curl` action I do fro...
I have
PHP-FPM
pool with such configuration blocks:
...
listen = 0.0.0.0:9000
...
pm.status_path = /status
...
I'm getting
curl: (56) Recv failure: Connection reset by peer
while trying
curl 0.0.0.0:9000/status
.
PHP-FPM
instance I try to interact with is containerized and curl
action I do from docker container.
Aleksey
(57 rep)
Jun 10, 2025, 08:51 AM
• Last activity: Jun 11, 2025, 10:25 AM
1
votes
4
answers
1753
views
Install memcache for Wordpress on debian with php-fpm
The install instructions for memcache are not really up-to date. How do I install on Debian using php-fpm and nginx? I tried this: apt install memcache zlib1g-dev php-dev pecl install memcache This will install the extension into /usr/lib/php/20220829/memcache.so So I added echo extension = memcache...
The install instructions for memcache are not really up-to date. How do I install on Debian using php-fpm and nginx?
I tried this:
apt install memcache zlib1g-dev php-dev
pecl install memcache
This will install the extension into
/usr/lib/php/20220829/memcache.so
So I added
echo extension = memcache.so>>/etc/php/8.1/fpm/php.ini
Then restarted
service php8.1-fpm restart
Now I want to install the "Memcached Object Cache" Wordpress Plugin, but the [plugin-website](https://de.wordpress.org/plugins/memcached/#installation) just sais:
> 1. Install memcached on at least one server. Note the connection info. The default is 127.0.0.1:11211.
>
> 1. Install the PECL memcache extension
>
> 1. Copy
object-cache.php
to wp-content
>
> 1. Add the WP_CACHE_KEY_SALT constant to the wp-config.php:
>
> define( 'WP_CACHE_KEY_SALT', '...long random string...' );
I cannot find object-cache.php
anywhere.
---
The problem is, that phpize will use php8.2 to compile the extension. but if I uninstall php8.2, I also uninstall php-dev. If I reinstall it, it will try to install php8.2 again ;(
How do I solve this?
rubo77
(30435 rep)
Apr 11, 2023, 01:40 PM
• Last activity: Jun 9, 2025, 10:16 AM
0
votes
2
answers
2148
views
Installing Composer on CentOS with multiple PHP versions
I have multiple versions of PHP (5.6 and 7.2) installed on my CentOS 7 server. Googling CentOS 7 Composer installation seems to have the same guide, just under a different blog with these steps: $ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer $ chmod +x...
I have multiple versions of PHP (5.6 and 7.2) installed on my CentOS 7 server.
Googling CentOS 7 Composer installation seems to have the same guide, just under a different blog with these steps:
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
$ chmod +x /usr/local/bin/composer
$ composer -V
Composer version 1.5.2 2017-09-11 16:59:25
However, this threw an error straight away. So I changed this command:
$ curl -sS https://getcomposer.org/installer | php
to:
$ curl -sS https://getcomposer.org/installer | php72
This now downloaded the file, however when I tried using composer -V (after the other steps) it throws this error:
> /usr/bin/env: php: No such file or directory
So I vim'd into
/usr/local/bin/composer
to see the line right at the top:
#!/usr/bin/env php
I changed that to
#!/usr/bin/env php72
but doing composer -V
now shows:
PHP Fatal error: Uncaught PharException: phar "/usr/local/bin/composer" has a broken signature in /usr/local/bin/composer:23
Stack trace:
#0 /usr/local/bin/composer(23): Phar::mapPhar('composer.phar')
#1 {main}
thrown in /usr/local/bin/composer on line 23
I tried the same with php56 to the same result.
How do I go about installing composer correctly on a CentOS 7 server running multiple versions of PHP?
Sidenote: lemme know if this is better for say ... superuser
treyBake
(389 rep)
Apr 10, 2019, 08:52 AM
• Last activity: Jun 8, 2025, 11:04 AM
0
votes
0
answers
31
views
Apache2 PHP error_log() doesn't work when called in some PHP code
On my Linux Ubuntu system I run `apache2` web server in the context of a `PHP` based web application. `phpinfo()` reports the following error_log /opt/unetlab/data/Logs/php_errors.txt I.e. `error_log()` is supposed to send messages to `/opt/unetlab/data/Logs/php_errors.txt` file. On `PHP` code that...
On my Linux Ubuntu system I run
apache2
web server in the context of a PHP
based web application. phpinfo()
reports the following
error_log /opt/unetlab/data/Logs/php_errors.txt
I.e. error_log()
is supposed to send messages to /opt/unetlab/data/Logs/php_errors.txt
file.
On PHP
code that handles the application's REST API, I use error_log()
function to log some debugging info.
The weird thing is that sometimes error_log()
doesn't write anything on the log file. Nevertheless error_log()
called from other PHP
code's files (e.g.functions.php
) works as a charm.
Which could be the problem ?
CarloC
(385 rep)
Jun 4, 2025, 02:06 PM
• Last activity: Jun 5, 2025, 05:56 AM
0
votes
2
answers
82
views
Troj/PHPShel-CE and PHP/Agent-BJNA trojan
I'm currently dealing with a real threat: the trojans Troj/PHPShel-CE and PHP/Agent-BJNA showed up on my system. I've decided to move to another provider – the first server IP was already blacklisted, and I want to stop any further damage. As a first step, I disabled apache2 and blocked all incoming...
I'm currently dealing with a real threat: the trojans Troj/PHPShel-CE and PHP/Agent-BJNA showed up on my system. I've decided to move to another provider – the first server IP was already blacklisted, and I want to stop any further damage.
As a first step, I disabled apache2 and blocked all incoming/outgoing ports except SSH (port 22). I'm now backing up only the important data (like .pdf, images, etc. – no .php, .exe, .com or anything executable).
But I'm still confused why Sophos didn’t detect the full extent of the infection. Here's what it found:
Severity,When,Event,User,"User Groups",Device,"Device Groups","IP Address"
Low,"2025-05-30T22:51:14+02:00","Scan 'Scan Now' completed",n/a,,mail,,xx.xx.xx.xx
High,"2025-05-30T22:39:03+02:00","Outbreak detected",n/a,,mail,,xx.xx.xx.xx
Medium,"2025-05-30T22:39:02+02:00","Malware detected: 'Troj/PHPShel-CE' at '/var/www/clients/client1/web7/web/wp-includes/l10n/class-wp-translation-file-security.php'",n/a,,mail,,xx.xx.xx.xx
Low,"2025-05-30T22:38:45+02:00","Malware cleaned up: 'PHP/Agent-BJNA' at '/var/www/clients/client1/web3/web/wp-content/plugins/wpforms-lite/vendor_prefixed/apimatic/jsonmapper/tests/namespacetest/model/.1748559585'",n/a,,mail,,xx.xx.xx.xx
more... about 150 times...
After scanning multiple times, some of the same files were detected again – so clearly something is still active.
I chatted with Claude (AI assistant), and he suggested checking all user crontabs, using this:
echo "Checking crontabs..."
for user in $(cut -f1 -d: /etc/passwd); do
echo "--- Crontab for $user ---"
crontab -u "$user" -l 2>/dev/null || echo "No crontab for $user"
done
At first, nothing suspicious came up – but then I found something under a user called web10:
root@mail:/usr/local/sbin# crontab -u web10 -l
* * * * * /usr/bin/php -r 'eval(gzinflate(base64_decode("jVJtj5pAEP7**** LOT MORE ****==")));
###### My question:
When we move to a new (managed) hosting provider, is there a risk that some infected files could sneak into the new system during the migration – even if we’re careful and avoid transferring obvious malware like .php and .exe files?
###### My setup:
Ubuntu 24.04.2, apache2, php 8.3/8.4, ispconfig3
Harvey68
(1 rep)
Jun 1, 2025, 09:23 AM
• Last activity: Jun 3, 2025, 08:44 AM
0
votes
3
answers
89
views
php code does not execute
I want to execute a PHP code from VS.code on Debian OS. I'm sure the Apache is installed and active. I'm sure the PHP is installed. I'm sure about the php.executepath is correct. when I navigate to locallhost/ping.php the web page is loading but when I want to enter the IP and ping it there isn't an...
I want to execute a PHP code from VS.code on Debian OS.
I'm sure the Apache is installed and active.
I'm sure the PHP is installed.
I'm sure about the php.executepath is correct.
when I navigate to locallhost/ping.php the web page is loading but when I want to enter the IP and ping it there isn't any result on the page!
this is my code:
ping
'.shell_exec(($cmd)).'
'; } ?> IP :
Daryush
(331 rep)
May 17, 2025, 07:55 AM
• Last activity: May 17, 2025, 02:54 PM
0
votes
1
answers
5034
views
Execute an shell script with sudo inside from php
I want to execute a command line command as root from a php file. In my case I want to view the crontab file in my php page. Running the `sudo` command in php is not recommended and on my raspberry pi with raspberry pi OS the php line echo (shell_exec("sudo more /var/spool/cron/crontabs/pi")); does...
I want to execute a command line command as root from a php file. In my case I want to view the crontab file in my php page.
Running the
"; echo (shell_exec("/var/www/html/cmd/crontab.sh")); ?> When I execute the crontab.sh in the command line. It seems to work. Because I see the crontab text. When I load the php page. I do not see the crontab text. I only see Get Current User: pi Who am I: www-data Start Crontab End Crontab What can I do? I had a cron that used
sudo
command in php is not recommended and on my raspberry pi with raspberry pi OS the php line
echo (shell_exec("sudo more /var/spool/cron/crontabs/pi"));
does not work. So I created a shell script:
**crontab.sh**
#!/bin/bash
echo "Start Crontab"
sudo more /var/spool/cron/crontabs/pi
echo "End Crontab"
and I created a php page:
**crontab.php**
Who am I: ".(exec("whoami"));
echo ""; echo (shell_exec("/var/www/html/cmd/crontab.sh")); ?> When I execute the crontab.sh in the command line. It seems to work. Because I see the crontab text. When I load the php page. I do not see the crontab text. I only see Get Current User: pi Who am I: www-data Start Crontab End Crontab What can I do? I had a cron that used
rsync
to copy the crontab -e
file to a cron.txt
file every hour. It worked but i do not want to view an (old) copy.
edit: My problem is that the task that starts with sudo gives zero output. In the comments I got the suggestion to use sudo crontab -l
. That's better than the line I used because it gives the root crontab and I just did not know of the -l
solution. But the problem is still there. There is zero output.
MacQwerty
(21 rep)
Apr 4, 2021, 01:43 PM
• Last activity: May 8, 2025, 07:01 PM
0
votes
1
answers
9510
views
Installing mysqlnd for php 5.6 on CentOs 7
I get php warning: > mysql_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50624 Also I read that I need to install mysqlnd to my server. I tried do it using: > yum install php-mysqlnd but get error: Transaction check error: file /etc/php.ini from install of php-c...
I get php warning:
> mysql_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50624
Also I read that I need to install mysqlnd to my server. I tried do it using:
> yum install php-mysqlnd
but get error:
Transaction check error:
file /etc/php.ini from install of php-common-5.5.34-1.el6.remi.x86_64 conflicts with file from package php56w-common-5.6.20-1.w7.x86_64
file /usr/lib64/....
Edgaras Karka
(2707 rep)
Apr 14, 2016, 01:05 PM
• Last activity: May 5, 2025, 07:02 PM
2
votes
2
answers
95
views
How to preserve newline characters in journald logs from PHP script stdout?
I have some service, which executes php scripts and sends its stdout to journald. Journald splits the log record by newline. This can be read under lineMax: - [journald.conf(5) - systemd | Debian Manpage][1] For example: ``` 1 ``` Then I get from journalctl ``` May php[107850]: Thisisline 1 May php[...
I have some service, which executes php scripts and sends its stdout to journald. Journald splits the log record by newline.
This can be read under lineMax:
- journald.conf(5) - systemd | Debian Manpage
For example:
1
Then I get from journalctl
May php: Thisisline 1
May php: This is line 2
May php: This is line 3
May myapp: Thisisline 1
This is line 2
This is line 3
Is there any way to preserve newline characters or support multiline (e.g., stack traces or formatted output) so that they appear as a single entry in the journal without the logger API?
Any advice how to approach it?
Dano Logos
(21 rep)
May 2, 2025, 11:32 AM
• Last activity: May 3, 2025, 09:26 AM
0
votes
1
answers
4135
views
How to allow pdf files in .htaccess?
I have this following codes in my htaccess file, but it doesn't allow pdf file to open, it will redirect to 404 page. how can I allow pdf files to open based on my following htaccess file. RewriteEngine on RewriteCond $1 !^(index\.php|images|public|assets|uploads|themes|updates|asset|mob|robots\.txt...
I have this following codes in my htaccess file, but it doesn't allow pdf file to open, it will redirect to 404 page. how can I allow pdf files to open based on my following htaccess file.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|public|assets|uploads|themes|updates|asset|mob|robots\.txt\.pdf)
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Header set Cache-Control "max-age=604800, public"
I highly appreciate your help. Thank
Jona
(1 rep)
Dec 31, 2017, 05:56 AM
• Last activity: Apr 28, 2025, 03:05 PM
0
votes
1
answers
5347
views
Run root script from www-data user
I have a problem to run a command that requires root privileges via php on the apache server 1. I added a command to sudoers so that it does not require a password for the user visudo: ``` # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /et...
I have a problem to run a command that requires root privileges via php on the apache server
1. I added a command to sudoers so that it does not require a password for the user
visudo:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path = "/ usr / local / sbin: / usr / local / bin: / usr / sbin: / usr / bin: / sbin: / bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL = (ALL: ALL) ALL
# Allow members of group sudo to execute any command
% sudo ALL = (ALL: ALL) ALL
# See sudoers (5) for more information on "#include" directives:
#includedir /etc/sudoers.d
www-data ALL = NOPASSWD: / sbin / iw
2. Php script that I am trying to execute, I also check the error that is returned
';
$ last_line = system ('sudo / sbin / iw wlan0 scan 2> & 1', $ retval);
// Printing additional info
echo '
Last line of the output: '. $ last_line. '
Return value: '. $ retval;
?>
php script returns
sh: 1: sudo: not found
Last line of the output: sh: 1: sudo: not found Return value: 127
sudo is installed, and works fine when I execute from other user
whoami returns "www-data" so user is ok
www-data belongs to the
sudo group
groups www-data
www-data: www-data sudo
user22090909
(15 rep)
May 15, 2022, 03:17 PM
• Last activity: Apr 27, 2025, 12:02 AM
1
votes
3
answers
2083
views
Yum install php v5.4 packages while I have installed php 7
I have installed PHP version 7 on my centOs. Now I got an error says: > undefined function mb_internal_encoding() So I decided to install php-mbstring (using `yum install php-mbstring`) but I face the following error: > Error: php70u-common conflicts with php-common-5.4.16-43.el7_4.x86_64 > > Error:...
I have installed PHP version 7 on my centOs.
Now I got an error says:
> undefined function mb_internal_encoding()
So I decided to install php-mbstring (using
yum install php-mbstring
) but I face the following error:
> Error: php70u-common conflicts with php-common-5.4.16-43.el7_4.x86_64
>
> Error: php70u-json conflicts with php-common-5.4.16-43.el7_4.x86_64
But now when I install php-mbstring, it wants to install php-mbstring version 5.4.
How can I tell yum to download latest versions of php extensions and packages?
Leo
(111 rep)
Jan 8, 2018, 06:13 AM
• Last activity: Apr 21, 2025, 12:05 AM
Showing page 1 of 20 total questions