I am haveing trouble with getting a cron job to work with codeigniter
I have used these instructions.
https://www.codeigniter.com/user_guide/general/cli.html
But it is not working
Here is what I have.
php /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
But it is not finding the right controller or the method, instead it is going to the "default_controler". Everything else I've tried gets a 404 not found error.
I've been pulling my hair out for two days trying to get this to work so any help would be greatly appreciated.
Thanks
EDIT
This works:
wget -q http://propalert.asia/admin_notifications
But the problem with this method is that Codeigniter's method for protecting the script by checking whether it is accessed by cli returns false.
I came across this post at CI's forum describing the same problem.
https://ellislab.com/forums/viewthread/236475/#1055830
Unfortunately he never got an answer there either.
I finally found the solution:
/usr/bin/php-cli -q /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
the key is "php-cli" instead of "php".
But then there is a bug in the CI core that needs to be fixed. You can find the solution to that here:
https://ellislab.com/forums/viewthread/227672/
Related
I am still fairly new with CakePHP and leaning with version 4. I can read PHP session values in a template index.php file with below. I think that is wrong way to do but I tested anyway.
$userrole_id = $this->request->getSession()->read('Auth.userrole_id');
And now I am trying to read session values in View Helper so that I can use same code in many different places. But above code throws an error with "Call to a member function getSession() on null". And as you can see in the above one line code, I have Authentication set up and that is working fine. And I have helper loaded in AppView.php, and that is loaded fine, too.
I am pretty sure I am missing basic stuff but I cannot figure it out. Any suggestions would be appreciated.
I found a solution in the official documentation, and I needed to do like below:
$this->getView()->getRequest()->getSession()->read('Auth.userrole_id');
I'm developing a Laravel 8.x app in the current version of VS Code. I have a dump() statement in a Controller that I've written so that I can determine precisely what's in the $request that is being handled because I suspect that my date isn't exactly what I think it is. I've added this to the store() method: $request->dump() and I'm pretty sure it has executed but I can't find the output from the dump() function anywhere. I've got Debugbar installed and it does not show the dump() output. Ditto for any window of the browser like the console, inspector, etc. I've looked in the laravel.log but it's not there either. I've checked each of my terminal windows - the ones dedicated to php artisan serve and npm run watch and the one I use for all other commands but I can't find anything there. I'm out of ideas on where to look.
If the Laravel docs tell you where to find the output, I missed it; they describe what dump() and dd() do but I can't find where they describe where the output is written.
I'm pretty new to Laravel and I'm working alone so I have no work colleagues to ask. Could someone kindly tell me where to find the output of dump() so that I can debug this program?
None of the comments pointed me to precisely where I eventually found the dd() output so I'm posting it here for the sake of any future person who has the same issue. I finally found it in the browser, in the console tab (I'm using Firefox) and within the Response to the Axios statement that tried to write the new record to the database. Here's a picture:
I had assumed that the information wouldn't require me to drill down as far as I did; I thought it would be as visible as normal console.log() output.
I'm very grateful to those who replied to my question; you finally got me looking in the exact right place. I've never used dd() or dump() before, even in vanilla PHP, so I really had no idea where the output got written.
Just upgraded from Laravel 6 to 7, and had the error response above when submitting a contact form. I eventually found a solution that seems to work and I am submitting here to help out the next guy.
In the terminal run:
composer require illuminate/mail
Add the following to the top of the controller file (app/Http/Controllers/Main.php in my case):
use \Illuminate\Support\Facades\Mail;
Add this to bootstrap/app.php:
$app->register(Illuminate\Mail\MailServiceProvider::class);
Save and test, and it worked localhost.
If the above does not work for you, there are some other possible issues and solutions available at this link, where I must give credit to vipindasks.
https://laracasts.com/discuss/channels/lumen/lumen-52-mail-not-working
Since I am suppose to ask a question:
Do you see any problems with this solution even though the site and mailer is working now?
You are simply missing a backslash. This tells the autoloader that the file you are looking for is not in the namespace your controller resides in :
$app->register(\Illuminate\Mail\MailServiceProvider::class);
Run composer update hope this will help you
For some reason most of my pages are giving this error "Call to undefined method DateTime::getTimezone()". I'm kind of positive that the pages that have this error got a ->created_at->diffForHumans() function. I still have no idea whats causing this.. It has been working fine since forever.
I tried updating my packages but there was no luck there.. Searched around for the function itself or inside my controllers.. also no luck. Checked my time zone in config/app.php and it had the same time zone that I've always had which is Asia/Amman
Check this discussion please:
https://github.com/laravel/framework/issues/24886
As it say there:
This issue is closed as it is not an issue with Laravel; it was an
issue with the PHP docs at the time, which have since been updated. I
would suggest you review your own code and make sure it's not a
namespace problem (i.e. use new \DateTime instead of new DateTime) and
if you still can't figure it out, post a question on StackOverflow
with the minimum amount of code needed to reproduce the error.
Edit:
Since this was after a Composer update, I would guess that the problem
lies with one of the packages that were updated. The error message
should give you the exact line number producing the error, which
should help you determine what package is causing the error. Then file
a bug report (or pull request) against that package if possible.
I hope it helps.
I kept changing the php version and it eventually worked. It was 7.1.22 and I changed it to 7.2.* and it worked just fine...
I'm trying to get Sensu twitter-handler working on my environment. The issue is that I'm not getting any errors on screen or logs when I cat a .json event into the twitter-handler and, the tweets are not being shown on the linked account.
Here're are my config files:
https://gist.github.com/Mariano-gon/8648427
https://gist.github.com/Mariano-gon/8648455
https://gist.github.com/Mariano-gon/8648489
This is the output I get:
https://gist.github.com/Mariano-gon/8648480
One important note is that in sensu-api.log the request are being recieved:
https://gist.github.com/Mariano-gon/8673758
So, my question is: is there a way to troubleshoot this issue? Any way to debug the handler.rb?
Thanks!
Finally got it working! Thing was the new 'twitter' gem (in my case v5.6) won't work with the code as it was written. I needed to follow this great answer and this thread too. Was just a matter of sintaxis (as usual).
Thanks!