Lobsang Tsering
Lobsang Tsering

Reputation: 1

function pcntl_exec() undefined but function exists

I am using Debian 9, Apache, PHP 7.0. When running command

php -r "pcntl_exec('/bin/bash','/tmp/1');"

is correct, but when I visit the PHP file in the browser, it shows me that

undefined function pcntl_exec()

Even I try to use the file below it is also right, it can run.

php -F "/var/www/html/pcntltest.php

I try to use function_exists(). When I run it in bash, is true, but in php result is false.

/var/www/html/1.php:

<?php pcntl_exec('/bin/bash','/tmp/1');?>

/tmp/1:

ls /

packages:

sudo apt-get install apache2 

sudo apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-gd php7.0-json 
php7.0-cli php7.0-curl libapache2-mod-php7.0

Upvotes: 0

Views: 383

Answers (0)

Related Questions