php exec and cpanel terminal issue - php

i have a server that have 2 hard drive, i have install cpanel on home directory and some of website are in home2
also my server is cent os 7.9
now my issue is when install for example ffmpeg on server, site on home can use it in php shell_exec but site in home2 can't use and get error command not found
i add user of site in home 2 to wheel group and if i connect using ssh ,it work with ffmpeg command but if i try using shell_exec or cpanel terminal it's return command not found error
what is the problem? can any one help?

Related

Error When Installing Magento - Could not validate a connection to Elasticsearch

I'm installing Magento 2 for the first time following this tutorial https://www.javatpoint.com/how-to-install-magento-2-using-composer. XAMPP is installed (with Apache and MySQL running), the database is setup on PHPMyAdmin, but when I try to run php bin/magento setup:install (step 23 in the tutorial) I get the error: Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
How can I fix this?
Download Elastic Search first on your system -
https://www.elastic.co/downloads/past-releases/elasticsearch-7-6-0
After Downloading follow this step -
Extract the .zip file
Open Terminal or command prompt and go to the extracted path
run command .\bin\elasticsearch.bat
if this does not work just go to the extracted folder and opened the elasticsearch.bat file inside the bin folder.
and the install Magento with setup: install command.
Hope it helps!!
Please run this Command in Terminal
sudo service elasticsearch start
And after run that command again run php bin/magento setup:install
Hope Your issue will be solve.
Thank you.

Meshlabserver : Cannot connect to X server error

I have meshlab installed in my machine running Ubuntu 14.04 OS. I can access it from command line using meshlabserver command. But problem arises whenever I try to call it from a php script using the command
<?php
system('meshlabserver 2>&1');
?>
It shows the error meshlabserver: cannot connect to X server. After going through a few websites I did the following things:
I moved the meshlabserver executable from /usr/bin to /usr/local/bin and gave it executable permissions using
sudo chmod a+x meshlabserver
But when I ran the whoami command from my php script (calling the meshlabserver), it showed www-data. So I gave executable permissions for all users to the meshlabserver using
sudo chmod 777 /usr/local/bin/meshlabserver
But still it is showing the same meshlabserver: cannot connect to X server error. meshlabserver comamnd is working fine when ran from the command line.
I really need to call meshlab from the php script for my website. Thus any help would be highly appreciated. Thanks in advance.
It seems the php script can't access your display variable. If you logged in via ssh remember to tunnel your X-server via 'ssh -X ...' Your second option is to create a virtual frame buffer using Xvfb and redirect the display variable to it:
export DISPLAY=:100.0
Xvfb :100 &
Note the ampersand for the second command as Xvfb needs to be running in the background.
a combo of prior answers works for me:
ssh -X, as well as export DISPLAY=:0.0 (on remote)

How to run PHP in WAMP as an Administrator

I want to run PHP (5.2.5) on WAMP as the administrator user on Windows 8. Currently when I run exec("whoami") it returns "nt authority/system". I want it to run as the Administrator (or more precisely "aaron-desk/administrator") so that I have the correct permissions to run a command line program (TileMill).
I have tried running WAMP as the administrator, but PHP still runs exec() under the system username.
I have also tried setting up services.msc to run the wampapache and wampmysqld services as Administrator (instead of Local System), but when I do this they fail to run. There is a login error. I have an empty Administrator password but it does not work for these services when I apply it in services.msc.
I am running Windows 8 Pro as the administrator.
This gives instructions how to do it in French. You download and install setacl. And then run:
setacl -on "wampapache" -ot srv -ace "n:Username;p:start_stop,read" -actn ace
setacl -on "wampmysqld" -ot srv -ace "n:Username;p:start_stop,read" -actn ace
WampServer forum

Adding git-ftp to my environment for php

I've installed git-ftp onto my CentOS Server so that I can do deployments from an activeCollab installation running the ac_gitolite module.
Everything installed fine and the app lives at
/usr/local/bin/git-ftp
When I log into the server via ssh I can run git-ftp commands without the full path, but when attempting to use PHP to run commands with exec ie:
exec ("git-ftp --version 2>&1", $output);
I receive the following error:
sh: git-ftp: command not found
Is there an environment path I need to specify somewhere specifically for PHP, or what am I doing wrong?
The two options discussed in "command not found - error in exec() command" are:
One easy solution would be to put the full path of the git-ftp executable.
The other is to add git-ftp to the php server user's PATH.

Running wget with PHP and apache (MAMP)

I have trouble running wget through php exec or system functions. The configuration is with MAMP.
I successfully run basic commands like ('whoami', 'pwd', etc.).
I even changed the apache user to the root user and still nothing. In the error log it output "wget: command not found".
I can run with the terminal and it works fine. The wget is installed through Macports.
What should I do?
Regards!
From a terminal, run which wget, and use the full path in the call to exec/system.

Categories