Questions tagged [php-cli]
The php-cli tag has no usage guidance.
32 questions
0
votes
2
answers
77
views
mysql not inserting through php cli
I have a simple php script which is ran from cli. I have tried many different variations of mysql code, but regardless, the line isnt inserted in the database even though php says it is....
<?php
$...
0
votes
1
answer
728
views
Cronjob Files Not Closing and 100% CPU usage
I'm running a php file every 10 seconds with a cronjob. While the system was running fine, I noticed last night that php was using 100% of the CPU and crashing the system.
When I checked with ps aux, ...
1
vote
2
answers
16k
views
How to enable/disable PHP extension for PHP CLI if there is no loaded configuration file?
I just executed php -i | grep "Loaded Configuration File" to find out where the configuration file of my PHP CLI is stored, but I get: Loaded Configuration File => (none). So it loads the ...
0
votes
1
answer
3k
views
Where to give index.php properly?
I have /var/www/html/moodle as my website directory. When in mysite.conf the settings are as follows:
DocumentRoot /var/www/html
DirectoryIndex "index.php"
mysite.com gives an Index of/ page since ...
2
votes
1
answer
3k
views
/usr/bin/php vs /bin/php vs php in bash [closed]
We are running a php client command. php xx yy zz run just fine but not its counter parts (/usr/bin/php and /bin/php) which give very weird error.
I am so confused row, given that :
command -v php |...
0
votes
1
answer
366
views
Permission error from Supervisor when full PHP path not specified
I've compiled PHP from source on Debian Stretch in a docker container.
I have added this entry to my Supervisor config:
command=/bin/sh -c 'QUEUE=orders/create APP_INCLUDE=/var/www/html/jobs/...
1
vote
0
answers
79
views
Set SERVER vars programatically from the CLI
I need a script to set the SERVER variables programatically when executing a PHP script from the CLI.
The idea is to get the SetEnv lines from an apache config file and feed them into the cli ...
0
votes
0
answers
177
views
php performance issues between two servers
I know this question might be too broad but I'm desperate.
Prenote: Here I'm testing php with CLI but same difference occurs with Apache+PHP too. But to avoid Apache caching and other stuff I used ...
2
votes
1
answer
767
views
Ec2 Cronjobs - High CPU usage
I have an EC2 Instance (micro) running a cakephp API. This instance serves quality validation before deploying into production.
On this instance, we have 5 cronjobs that run once each minute. Those ...
1
vote
1
answer
1k
views
Do not use .htpasswd when env set to specific value
I have .htpasswd protection on my site that works fine. When I call a script that puts everything into cache via PHP CLI I get a 401 error. The problem here is the .htpasswd protection.
In the CLI ...
0
votes
1
answer
2k
views
CentOS 7 mysqli works on php apache but not on php-cli
I have php7.2 installed(from remi repository) in CentOS 7.5. I want to access mysqli from command line php. When trying, it shows the error:
Call to undefined function mysqli_connect()
The php ...
0
votes
0
answers
4k
views
PHP Startup: Unable to load dynamic library php_soap.dll: cannot open shared object file: No such file or directory in Unknown on line 0
After installing PHP soap when I run php via command line it throws an error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_soap.dll' - /usr/lib/php/20151012/...
2
votes
1
answer
10k
views
Pass environment variables to the PHP CLI and FPM
I want to use environment variables in my PHP applications both CLI and FPM. What I do is I:
export some variables in /etc/environment.
configure both php.ini (CLI and FPM) to variables_order = "...
0
votes
1
answer
834
views
Where does echo end up when a php script is executed from a shell script?
I have a php script that I execute from a .sh file, and have some echoes in it.
if I run the script from the terminal, I can see all the output, but where does it go when it is running in the ...
6
votes
1
answer
2k
views
Nginx + PHP maximum output limit
I have php 5.5 (fpm) and nginx 1.10 installed (gzip configured to 1). Running on ubuntu.
When I am "echoing" a large output (over 2 mb), it stops abruptly at around 520 kb.
But same program when I ...
0
votes
1
answer
5k
views
PHP 7 Module already loaded warnings
I have a machine running Ubuntu 14.04.3 LTS that is deployed via Ansible. I've got PHP 7 installed using Ondřej Surý's PPA for PHP.
$ dpkg -l | grep -i php
ii libapache2-mod-php7.0 7.0.3-...
2
votes
2
answers
4k
views
The apache2handler SAPI is not supported by pthreads
It has been weeks now that I cannot install pthreads. I am going to list the error logs then I will list my configuration options. These are the errors I get:(Apache Error Log)
The apache2handler ...
3
votes
1
answer
2k
views
PHP CLI not loading IMAP extension
When I try to run a script that uses imap in my browser, it works fine (it is loaded from a Ubuntu 14.04 server on my network with the extension installed). However, when I try to use PHP CLI on said ...
0
votes
1
answer
808
views
Configuring php7.0 with apache2
I'm running the newly released php7.0 on debian jessie. By now it works all fine.
Enabling the pdo_mysqli, I have found mutliple configuration directories for php7. There are:
apache2
cli
fpm
I'm ...
0
votes
2
answers
240
views
How to run 5 php processes, which uses different eth interfaces?
I'm using cron to run everyday script, which has to run 5 php-cli processes. I need them to use separate interfaces.
I have 5 devices, eth0, eth1, eth2, eth3, eth4.
How can I call php to make sure ...
0
votes
0
answers
1k
views
Bus error during PHP5 is running a simple script - what?
When working with PHP scripts, I usually do not have to bother with the underlying system. Today, I have to.
A PHP script (cronjob) that has worked fine is crashing since 2 days ago. The cronjob mail ...
3
votes
3
answers
5k
views
PHP cli uses different php.ini file when run by cron
My CakePHP console script is having problems executing under cron. It complains about missing Mysql connections and such.
After a little investigating I found that php run by cron uses a different ...
0
votes
1
answer
1k
views
What are the affects of disabling CGI on my server to enable PHP CLI
I have a DS WHM - cpanel running apache / with litespeed I have a number of websites running on this server I need to run CLI on one of the sites the CGI module is enabled in the apache build.
The ...
2
votes
1
answer
4k
views
PHP CLI: Call to undefined function mysql_connect() even with mysql module enabled
I try to run a PHP script from the command line, but get the following error:
Call to undefined function mysql_connect()
However, the mysql module is loaded:
root /var/www/scripts # php -m | grep ...
3
votes
2
answers
1k
views
Enable coloured PHP CLI messages on console [closed]
How to enable coloured messages for PHP CLI on console (Mac OS X, latest PHP/Apache from MacPorts)?
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
doesn't seem to be enough, all PHP CLI ...
5
votes
4
answers
30k
views
Apache executes HTML, but not PHP; PHP CLI works
I am running php 5.3.3 on rhel 6.2 with Apache 2.2.15 and am failing to get PHP code interpreted by Apache.
There are no errors (in the system log, httpd/error_log, or php_errors.log) - I have ...
2
votes
3
answers
974
views
PHP-CLI cannot execute scripts on Samba Share (using cifs) inside a guest VM (Centos 6)
I have a centos 6 VM running as a guest within Virtualbox.
I've set up a LAMP stack which I am able to access from the host (Windows) environment.
I've mounted a SMB share using 'mount -t cifs' and I'...
-1
votes
2
answers
833
views
PHP CLI error: Could not startup
I just installed the php5-cli package in Ubuntu 11.04. If I run:
/usr/bin/php5 -a # The -a is for interactive mode
I get the output: Could not startup.. However, if I add the -n option, which ...
2
votes
2
answers
5k
views
Changes made to cli's php.ini not taking effect
I have two php.ini files -
/etc/php.ini which loads in case of cli
/opt/lampp/etc/php.ini which loads in case of browser.
I am able to use PHP's Mailparse extension after adding the line ...
2
votes
2
answers
5k
views
PHP Warning: PHP Startup: apc.shm_segments setting ignored in MMAP mode
Any ideas on how i can fix this warning?
Getting this while executing it from shell, on FreeBSD 8.x
# /usr/local/bin/php --run 'echo "test";'
PHP Warning: PHP Startup: apc.shm_segments setting ...
2
votes
4
answers
8k
views
Do PHP files need read permission to be executed in CLI?
I have a php file test.php
#!/bin/php
<?php
echo "test";
?>
This file owned by root and its permissions are these
-rwxr-x--x
so 'others' can execute, but cannot read.
When logged in as ...
-2
votes
2
answers
178
views
enabling php-cli in php5
i wanted to install php-cli in php5.2.11..does it come built-in or should i install it?