Questions tagged [php-cli]
PHP CLI is the command-line interface for PHP.
47 questions
1
vote
2
answers
54
views
Update PHP cli on Ubuntu 22.04 LTS
I'm running Ubuntu 22.04 LTS server (plus Plesk Obsidian 18.0.77 Update #1)
Despite Plesk updates being up to date, and Ubuntu updates being up to date (sudo apt update && sudo apt upgrade), ...
0
votes
1
answer
63
views
kubuntu 22.04 won't run PHP cronjobs normally anymore (logs stay empty, script is never ran)
i have a PHP script that has ran correctly up to about 3 or 4 days ago, also from crontab.
it fetches RSS news items and puts them into a db.
the problem i have at the moment is that this script will ...
1
vote
1
answer
14k
views
Trouble updating PHP version used by Apache on Ubuntu 22.04
I have multiple PHP versions (8.1/8.2/8.3) installed on my Ubuntu 22.04 system. I'm trying to switch between them using the sudo update-alternatives --config PHP command. However, I'm facing an issue ...
1
vote
1
answer
10k
views
Ubuntu 20.04 has no installation candidate for php8.1-sqlite
Apparently package php8.1 is available for Ubuntu 22.04 but not available for 20.04. php7.4-sqlite is, however, available for 20.04.
In particular I'd like to use PDO with sqlite on PHP8.1 on 20.04. ...
-2
votes
2
answers
581
views
Inserting a new line into a PHP file via the CLI
Goal: Insert a new line into a PHP file via CommandLine.
Problem: I have a PHP file with an array. I want to append a new value (hello folks) to this PHP array using a bash script.
Starting point:
<...
24
votes
5
answers
90k
views
How to change PHP version in Ubuntu 20.04 console?
How can I change the PHP version used in console on Ubuntu 20.04? I have all versions in the /etc/php folder, but I don't know where the configuration for the command line version is.
1
vote
1
answer
3k
views
Removed /usr/bin/php
I've made a stupid mistake on a live webserver and need some help to recover.
While logged in as root ( mistake #1 ) I did a wget of a file to /usr/bin/php which created the directory /usr/bin/php ...
1
vote
2
answers
2k
views
How to create a laravel project in htdocs folder
I am a web developer. I have created projects in Windows OS, but now I have completely switched to Ubuntu 20.04. I have installed PHP and composer. But when I want to create a Laravel project in ...
1
vote
1
answer
708
views
.sh script not finding php?
I have this code in a bash script:
#!/bin/bash
php -f email_processor.php 'Corgi Boy' https://www.domain.com/corgi-boy/ domain.com https://www.domain.art Site Title
As a test, I ran it from the ...
1
vote
0
answers
2k
views
How to change php-cli to match phpinfo (7.3 => 7.4) Ubuntu
I am on Ubuntu 18.04 and I want to make my php -v match my phpinfo page.
php -v from the command line:
PHP 7.3.13 (cli) (built: Jan 8 2020 14:07:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend ...
2
votes
1
answer
842
views
Cronjobs not working but same command works fine from command line
I’ve installed Mautic (email program). It needs 3 cronjobs to run properly.
php /var/www/mydomainname/htdocs/app/console mautic:segments:update
php /var/www/mydomainname/htdocs/app/console mautic:...
2
votes
2
answers
28k
views
bash: /usr/bin/php: No such file or directory [closed]
When I try some code it says:
bash: /usr/bin/php: No such file or directory
I think It happened because of some codes I tried for a previous error of my laravel project.
These codes are:
mv /usr/...
3
votes
1
answer
5k
views
PHP Environment Variables in CLI
Environment Variables are used to set up the PHP application and the application runs smoothly.
The issue that I'm facing is when I'm trying to reference the application's database connection file and ...
0
votes
2
answers
829
views
Uninstalled PHP5.6 not working
I've uninstalled php5.6 on my PC then I upgrade to PHP7.2 but when I checked php cli php -v, it's show me like this, it's still show me PHP 5.6
Anyone can help me out ?
2
votes
1
answer
3k
views
Running PHP runs as root instead of logged in user
I have a little development environment with a PHP script that only contains the following:
whichuser.php
<?php var_dump( exec('whoami') ); ?>
When I try to execute this "script" via CLI the ...