Closed bedrijfsportaal closed 3 years ago
index.php
doesn't normally exit
with a status code as it is intended primarily in web requests. Have you tried adding an exit call in your index()
method?
namespace App\Controllers;
use App\Controllers\BaseController;
class Cronjob extends BaseController
{
public function index()
{
echo 'test';
+ exit(0);
}
}
Just tested this, but still no response in the command line, it's weird because i do remember this working in a earlier version of CI4.
EDIT: Did some more testing on what it accepts from the command line, but it seems it cannot do anything after index.php, some examples.
http://localhost:8080/cronjob/index
< visiting this url will output test
php index.php hello world
< non-existing, no response
php index.php?hello=world
< generated an error; could not open input file index.php?hello=world
Maybe this will help?
Call: php index.php hello=world
In your case: php public/index.php cronjob index
Call: php index.php hello=world
In your case: php public/index.php cronjob index
This doesn't work either, if the command is php public/index.php cronjob=index
it returns a 404 not found. The response on this command is Cronjob=index is not a valid controller name
.
I'm having a weird feeling i;m missing some extension to handle this but have no clue what that is...
Call: php index.php hello=world In your case: php public/index.php cronjob index
This doesn't work either, if the command is
php public/index.php cronjob=index
it returns a 404 not found. The response on this command isCronjob=index is not a valid controller name
.I'm having a weird feeling i;m missing some extension to handle this but have no clue what that is...
you don't need the "=", just call: php public/index.php cronjob if you have index as the default method.
If not jus use php public/index.php cronjob index
Call: php index.php hello=world In your case: php public/index.php cronjob index
This doesn't work either, if the command is
php public/index.php cronjob=index
it returns a 404 not found. The response on this command isCronjob=index is not a valid controller name
. I'm having a weird feeling i;m missing some extension to handle this but have no clue what that is...you don't need the "=", just call
php public/index.php cronjob
Same issue, no response in the command line. Expecting the test
back but nothing is responding
Also php public/index.php cronjob index
no response
Try to do return "test";
instead of: echo 'test';
Try to do return "test";
instead of: echo 'test';
Same issue, have been trying many things but in earlier versions echo wasn't an issue. Feel like something has been changed because my Linux (Ubuntu 20.x) server has the same issue, it's not just my Windows 10 machine.
I just replicate the same conditions on my Mac and it works perfectly with both echo and return.
It appears to be something else.
Are you trying to use just the terminal or you are using something else to make the call?
Using my Visual Studio code terminal, CMD terminal, Putty terminal (for my server). Nothing is responding, Did you use the same PHP version, have a feeling that is causing this issue. I'm using PHP 8.0.7 also on my server.
Using my Visual Studio code terminal, CMD terminal, Putty terminal (for my server). Nothing is responding, Did you use the same PHP version, have a feeling that is causing this issue. I'm using PHP 8.0.7 also on my server.
Just tested in PHP 8.0.7. It Works!
So what is missing in my case, because my Ubuntu server is facing the same issue...
So what is missing in my case, because my Ubuntu server is facing the same issue...
Can be any PHP extension???
This is my list of extensions:
;extension=bz2
extension=curl
;extension=ffi
;extension=ftp
;extension=fileinfo
;extension=gd
;extension=gettext
;extension=gmp
extension=intl
;extension=imap
;extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=oci8_19 ; Use with Oracle Database 19 Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
;extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp
extension=soap
;extension=sockets
;extension=sodium
;extension=sqlite3
;extension=tidy
;extension=xsl
;zend_extension=opcache```
If you give me restricted access to your server I can check It for you. Send me a PM
My server works with SSH keys and is restricted on 2 firewalls, to open this up i'll need to check a lot of things to keep my clients save. From the list above you did not see anything missing? That's the .ini for my Windows 10 machine.
exec: php -me
and compare with my environment: [PHP Modules] bcmath bz2 calendar Core ctype curl date dba dom exif FFI fileinfo filter ftp gd gettext gmp hash iconv intl json ldap libxml mbstring mysqli mysqlnd odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql PDO_ODBC pdo_pgsql pdo_sqlite pgsql Phar phpdbg_webhelper posix pspell readline Reflection session shmop SimpleXML soap sockets sodium SPL sqlite3 standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib
[Zend Modules] Zend OPcache
I've activated every last one of them, except for oci8_12c oci8_19 pdo_firebird and pdo_oci
but still no response. I'm stuck at this point because i've got no clue what is going on, thinking about setting up a dev server with ubuntu and give you access to that because i'm at a dead end right now..
I've activated every last one of them, except for
oci8_12c oci8_19 pdo_firebird and pdo_oci
but still no response. I'm stuck at this point because i've got no clue what is going on, thinking about setting up a dev server with ubuntu and give you access to that because i'm at a dead end right now..
Make a fresh copy of Codeigniter and just add the Cronjob controller with the code you post. Start from there. If you want to give me access I can help you. Just let me know.
I've activated every last one of them, except for
oci8_12c oci8_19 pdo_firebird and pdo_oci
but still no response. I'm stuck at this point because i've got no clue what is going on, thinking about setting up a dev server with ubuntu and give you access to that because i'm at a dead end right now..Make a fresh copy of Codeigniter and just add the Cronjob controller with the code you post. Start from there. If you want to give me access I can help you. Just let me know.
Ok so it seems to be an issue related to my installation, can confirm it is working on a default installation with the same .env file. Looks like i've got some debugging to work on, thank you so much for the reply and feedback on my personal issue!
Direction Trying to run the CLI command through Visual studio code or CMD but zero response from the output that has been set. To be shure i've created an empty file with default index and an echo with text 'test'. This still doesn't respond in any way.
Describe the bug No response or execution on the coding when executing the controller/method through CMD.
command:
php index.php cronjob index
Example:
CodeIgniter 4 version 4.1.3
Expected behavior, and steps to reproduce if appropriate A response as the documentation stated: Documentation command line
Context