Launching Laravel 4 artisan command through Cron task - cron

I'm new comer to Laravel 4 but not newbie for creating cron or using framework (codeIgniter / Yii, ...)
I set up an installation of Laravel 4, in my localhost and the same in my production web server.
When I launch a command via cron :
php -q path/to/laravel/artisan command:myspecificcommand or (same effect)
php -q path/to/laravel/artisan cache:clear
Then I obtain an Exception:
RuntimeException
Failed to start the session because headers have already been sent by "" at line 0.
It occurs in the vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
when I launch those commands in the console of MacOs all stuffs are achieved correctly.
I use in my production server: php 5.3.13, there is a output_buffered set (I look for that due to the title of the error) but I'm completly stuck.
I give image of the result (there is the stack)

It often very much depends on your hosting and how they've got things set up. Each hosting company will have their own way of setting things up.
PHP CLI is the command line interface for PHP (e.g. for creating standalone applications). The CLI version is intended to run on a command line (hence "Command Line Interface"). This one does not handle headers, or any other server-related things.
Although not a duplicate of your question, you might find this helpful: What is difference between php cli and php cgi?

Related

phpmyadmin.conf default file

First of all, I'm pretty new to this all...
I am using Amazon web services and I have installed LAMP on Amazon linux using this.
When installing phpmyadmin, I was trying to grant access to all IP addresses (i know, not a good idea), so I tried adding Require all granted under # Apache 2.4 in phpmyadmin.conf file, I was using Mac's terminal, and I messed up the file while trying to learn how to add it, so now that I found how to add it, it is not working anymore... this the error I get:
Stopping httpd: [FAILED]
Starting httpd: AH00526: Syntax error on line 1 of /etc/httpd/conf.d/phpMyAdmin.conf:
Invalid command '# phpMyAdmin - Web based MySQL browser written in php', perhaps misspelled or defined by a module not included in the server configuration
[FAILED]
Is there anyway that I can just replace the phpMyAdmin.conf file to default and start editing it over?
or do I have to unistall and re install phpmyadmin all over again?
Thanks

ejabberdctl command inside a script gives error "Connection attempt from disallowed node"

I'm running ejabberd-14.12 on a Debian 7.6 server, single node.
I've installed ejabberd with the interactive .run package.
I've started ejabberd (logged as root) with:
# /opt/ejabberd-14.12/bin/ejabberdctl start
The log tells that:
ejabberd_app:start:69 ejabberd 14.12 is started in the node ejabberd#localhost
Then, I can see the erlang cookie in my /root directory:
-r-------- 1 root root 20 ago 9 00:00 .erlang.cookie
If I try to create a user in command line mode, everything is ok:
# /opt/ejabberd-14.12/bin/ejabberdctl register foo myhost.lchat.local foopwd
And the user is created (I can see it on the web gui).
If the same command is embedded inside a .sh script (with the full command path), and launched by a daemon (owned by root), it generates an error in the ejabberd error.log:
[error] <0.435.0> ** Connection attempt from disallowed node 'ctl-ejabberd#localhost' **
I believe that it's a security issue, in order to avoid commands from unauthorized users.
What can I do to have the command accepted also from script ?
The error means the environment is not using the same cookie for connecting from the command Erlang node to the primary ejabberd node.
I guess the script run as another user (despite being own by root). The user that will run the script need to have the same .erlang.cookie file in its home directory.
Note: you should not run a server as root, ejabberd or any other type of network server. This is against security best practices.

Lua with Apache on Linux (Ubuntu Server) errors?

Iv'e been trying to set up a web server off my homes internet. At the moment its a dusty little Toshiba Netbook with and Ubuntu server running off of it. I have all that set up, and apache + php, but now i'm trying to get lua to work with it. I first edited the htttpd.conf to have the
LoadModule lua_module modules/mod_lua.so
line uncommented so it would load (I somehow got it to install with all the modules enabled, just not active), and I got this error after trying to start it back up.
httpd: Syntax error on line 116 of /usr/local/apache2/conf/httpd.conf: Cannot load modules/mod_lua.so into server: /usr/local/apache2/modules/mod_lua.so: undefined symbol: luaL_loadbufferx
Since this isn't working and I have no idea why, I'd like to ask you all for help! Thanks in advance for any help you might be able to offer!
Seems like mod_lua.so is unable to find the Lua library (in which luaL_loadbufferx function is implemented). Verify that LD_LIBRARY_PATH includes path to Lua library folder, and that the user account under which the web server runs has execute privileges on liblua51.so.

Jenkins ignores proxy settings while building a job

I set a proxy under Plugins in Jenkins like suggested online.
I also edited the /etc/environment
bash-3.2$ cat /etc/environment
http_proxy=proxy.company.net:8080
https_proxy=proxy.company.net:8080
HTTP_PROXY=proxy.company.net:8080
HTTPS_PROXY=proxy.company.net:8080
HTTPS_PROXY_REQUEST_FULLURI=false
HTTP_PROXY_REQUEST_FULLURI=false
I verfied the variables and they are available on logon.
When I start ant manualy as root via ssh, my "composer.phar" script is able to connect and download files. As soon as Jenkins starts the job (I think its the "jenkins" linux user), he waits until timeout and aborts the build. I used "su jenkins -s /bin/bash" to get a shell as "jenkins" and the env-vars are set correctly...
What can I do? Why does Jenkins ignore these ENV-Vars?
Thanks.
The http_proxy variables (as seen e.g. on the wget man page) require a "http://" prefix to work properly for many programs.
Jenkins on the other hand has a proxy configuration at Manage Jenkins > Plugin Manager > Advanced. This configuration overrides the environment variables.
Check Alex' answer to another question for getting around this behavior for individual nodes/builds.
I did not get it solved. After a restart the server fails all Jenkins Jobs for some minutes... suddenly the connection to the proxy succeeds and everything works well.

In-memory GUI session for UI automation

I'm automating web-UI testing using Selenium. All our existing non-UI related tests are executed through CLI by SSHing into the machine, and it would be great if there's a way to execute these UI tests through CLI by having an X-session run in memory. Is there such a thing in Linux?
There is, its called xfvb.
Sure. You can run a VNC server and have your browser display on that. Like so
noufal#sanitarium% vncserver
Warning: sanitarium:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server sanitarium:1
New 'X' desktop is sanitarium:2
Starting applications specified in /home/noufal/.vnc/xstartup
Log file is /home/noufal/.vnc/sanitarium:2.log
noufal#sanitarium% /usr/bin/env DISPLAY=sanitarium:2 /usr/bin/firefox --ProfileManager --no-remote
Xlib: extension "RANDR" missing on display "sanitarium:2.0".
will run a browser on the VNC
If you want to see it, you can do something like
noufal#sanitarium% vncviewer sanitarium:2

Resources