I have a php page that is trying to run a service restart using: $list=shell_exec(‘sudo /sbin/service NetworkManager restart’); I needed to edit my sudoers file to let this happen. Thus: #Defaults requiretty and apache ALL=(ALL) NOPASSWD: /sbin/service When that failed, as a test I ran: apache ALL=(ALL) NOPASSWD: ALL I have run a shell_exec without the sudo command: $list=shell_exec(‘whoami’); echo
Tag: php
strikethrough characters on php stream output
I am using php ssh2_exec to execute a ps aux command on a remote Linux server… The server initiating the connection is Ubuntu 14.04 and the server I am communicating with is Centos 6.6. Both systems are fully updates and I am using the following versions of PHP and Apache on the Ubuntu system: apache2 2.4.7-1ubuntu4.5 libapache2-mod-php5 5.5.9+dfsg-1ubuntu4.11 php5 5.5.9+dfsg-1ubuntu4.11
Parameter passing with usr/bin/php p in cron jobs
I have a problem with cron task creating. I created the task, and its working just fine on my server if I run the following command: At the crontab I use the following command: If I run this command, I only get the symfony commands list. In other words, it looks the same as if I type in just php
Copy network file from a Linux host to my Linux server using PHP
I am trying to retrieve a network file from an OpenSUSE 13.1 Host to my OpenSUSE 13.2 Webserver, but I don’t seem to have any success. First I check if target directory is a directory: In this case the function is_dir() returns FALSE, although the folder exists and has 777 permisions, the IP is correct, and the computer is turned
debugging long running PHP script
I have php script running as a cron job, extensively using third party code. Script itself has a few thousands LOC. Basically it’s the data import / treatment script. (JSON to MySQL, but it also makes a lot of HTTP calls and some SOAP). Now, performance is downgrading with the time. When testing with a few records (around 100), performance
Check PDF number pages with PHP (in Linux)
I have a webpage where I let users to upload files to the account folder. Exactly PDF and JPG files only. I want to count the number of pages inside each PDF uploaded to show it to the users. To do this, I was using PDFINFO linux library, part of XPDF proyect. This is the man page of the binary
file_get_contents() security issue on local domain only with CentOS security settings
I know there are a hundred posts about file_get_contents() on SO but nothing seems to solve my problem: Everything was working fine fifteen minutes ago, until I ran some security stuff via SSH. I added some iptables rules and I file_get_contents and I ran service proftpd restart and a few installs/uninstalls which seems to have disabled PHP’s fopen() functions somehow.
readdir function is not reading the whole directory on linux system
On my hosting provider i have a directory called hosts that has a structure like this the content of hosts.php file is this when i run hosts.php i get this output so php doesn’t show ma_women_com.php ! if i removed this useless line from hosts.php the output goes fine and it can read ma_women_com.php in addition if i removed on
-bash: laravel: command not found
I have installed the composer and move the composer.phar file to /usr/local/bin just follow the following step: Then I edit my ~/.bash_profile file as following: and save the change and excute: But, when I excute the laravel new test command, it returns an error: PS: in /usr/local/bin directory have no laravel command just composer command exists. Did I forgot something?
How to run php properly from the command line [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question