JMS\SecurityExtraBundle complains about permission errors under Fedora 18 - symfony

I have just upgraded my development system to Fedora 18-Beta. Just after this, my Symfony 2 projects stopped working, stating that JMSSecurityExtraBundle is trying to run grep, which exits with non-success status code of 2.

It seems that the Fedora guys have changed some context defaults for the httpd package. According to /etc/selinux/targeted/contexts/files/file_contexts:
/var/www(/.*)?/logs(/.*)? system_u:object_r:httpd_log_t:s0
they have changed the default context of all files in any directory called logs under /var/www. As some vendor directories contain .git dirs, which eventually contain a directory called logs, they will be automatically labeled as httpd_log_t.
The solution to change this, is to issue this command:
# semanage fcontext -a -t httpd_sys_content_t '/var/www(/.*)?/\.git/logs(/.*)?'

Related

Meteor command not found

I installed the same version from Official Windows Meteor Support on one computer and the command "meteor" runs normally, now I tried to install in another computer but is giving me the issue that the "meteor command was not found". I tried to add the path to the system variables, but it doesn't seem to work.
Any ideas? Thank you
I have just discovered in Windows (I am using Windows 8.1) that you have to type meteor.bat to invoke meteor. e.g. meteor.bat create myapp
The answers already listed were only half the answer for me.
The following steps, resolved the issue.
Set the SYSTEM Environment Variable to:
C:\Users\%username%\AppData\Local\.meteor
Or if you prefer, change to your username explicitly
C:\Users\rich\AppData\Local\.meteor
Then as per the accepted answer on this question.
Create a file named meteor in the directory where the meteor.bat is. E.g. the path above.
Hint, you can use
touch meteor
Copy these lines into the file and save
#!/bin/sh
cmd //c "$0.bat" "$#"
For others that might come across this issue.
I'm on Windows 10 and installed Meteor 1.4. Was getting meteor command not found when trying to run meteor from command prompt.
I checked my users PATH variables and found this entry:
C:\Users\%username%\AppData\Local\.meteor\
I removed the last backslash, saved the PATH variables, and then opened a new command prompt. The meteor command was now recognized.
My PATH variable entry now looks like this with the last backslash removed:
C:\Users\%username%\AppData\Local\.meteor
Note: You can replace %username% with your actual windows username. The entry should work fine as the system will resolve it to your username.
If path variable is not present in environment variables,
You can execute the command only from the directory where meteor is present. i.e., "C:\Users\username\AppData\Local.meteor\" directory.
To use the meteor from any directory inside the command prompt,
Add path variable to the environment settings.
"C:\Users\username\AppData\Local.meteor\meteor.bat".
Restart command prompt if already open.
This will enable meteor command to work everywhere.
The question is old but it might help others who face similar issue.
I just installed meteor and had the same issue. It looks like it installed successfully and added C:\Users\USERNAME\AppData\Local.meteor to the User variable (not system variable).
I am using Windows 10 and I might have to re-login or reboot for that to start working properly.
So, to use without re-login or reboot, use complete path in the directory where you want to create the project:
C:\Projects> C:\Users\USERNAME\AppData\Local.meteor\meteor my_project
Hope it helps.
Using the Node Command prompt instead of Terminal worked for me. Search for Node Command Prompt in the Start Menu.
On Linux,
If the problem comes from systemd service (systemclt) configuration, the PATH is not recognized properly, then:
Here is the error log:
Feb 3 00:13:43 localhost metassa-org[65870]: > meteor run --port=9999
Feb 3 00:13:43 localhost metassa-org[65881]: sh: 1: meteor: not found
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! code 127
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! path /var/www/domain.org/meteor/simple-todos-react
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! command failed
Edit your service configuration file:
Environment="PATH=/home/ubuntu/.npm-global/bin:/home/ubuntu/.meteor:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$PATH"
Replace /home/ubuntu with your user folder containing meteor install.
You may replace all with your current $PATH value instead.
ExecStart=/usr/bin/npm run start --prefix /var/www/meteor/simple-todos-react
Modify /var/www/meteor/simple-todos-react with your meteor project
Finally, restart your service.
sudo systemctl daemon-reload

Twig cache permissions

I just worked with Windows 7 before and now I'm working with MAC OS. I cloned my project (it works with Twig and wordpress and I'm using a virtual machine via vagrant) and everything should work but when I enter the website it gives me the following message:
Uncaught exception 'RuntimeException' with message
'Unable to create the cache directory (/vagrant/myProject/cache/c2/94).'
in /vagrant/myProject/wp-content/.../libraries/Twig/Environment.php:1199
I guess it is some kind of problem about permissions but I don't know how to fix it exactly. Any help? Thank you.
As soon as you created a /vagrant directory, I think default permissions are root.
You can try:
sudo mkdir /vagrant/myProject/cache
sudo chown -R $USER:staff /vagrant
And then try again (assuming your current user runs the apache server).
If this does not work, please do:
ls -l /vagrant
and:
ls -l /vagrant/myProject/cache/
And try to set permissions so the cache permissions are the same.

Varying Vagrant Vagrants switching wordpress-trunk to git

I am trying to convert Varying Vagrant Vagrant's wordpress-trunk (or development) site to be provisioned via git instead of svn.
There seems to be a script (I presume it is a script even though it has no file extension) as part of the VVV project that will switch after the machine has been provisioned:
https://github.com/Varying-Vagrant-Vagrants/VVV/blob/master/config/homebin/develop_git
And the author told me that running the following from command line should do it:
vagrant ssh -c "develop_git"
but when I run that I get the following error:
Unknown cipher type 'develop_git'
There appears to be some code in the provision script that mentions git, but I have no idea what I am looking at.
So, does anyone know how to run/implement that script? Or otherwise convert the www/wordpress-trunk folder to git? Are there options somewhere to direct VVV to provision the trunk folder from git in the first place?
Contrary to the Vagrant-Documentation of vagrant ssh the -c option is delivered to the ssh command and therefore interpreted as the cipher-specification.
I would suggest you to try vagrant ssh -- "develop_git", since everything after "-- (two hyphens)[is] passed directly into the ssh executable".

Completely remove openstack from system after installation from devstack script

I am installing OpenStack on my local machine via this link. But I am having trouble in completely removing installed components from my local machine. I ran following command:-
$ sudo ./unstack.sh
tgtadm: can't send the request to the tgt daemon, Transport endpoint is not connected
tgtd seems to be in a bad state, restarting...
stop: Unknown instance:
tgt start/running, process 14629
tgt stop/waiting
Volume group "stack-volumes" not found
Skipping volume group stack-volumes
And file are still present in /opt/stack and /usr/local/bin/. But manually removing these file will not be a good option.
The unstack.sh script only stops the services without removing them.
Devstack's folder contains a clean.sh script that removes openstack and dependencies so you can run something like this:
cd path/to/devstack
# There's no need to call unstack.sh explicitly
# clean.sh invokes that script itself.
./clean.sh
Follow the following 3 steps:
./clean.sh
rm -rf /opt/stack
rm -rf /usr/local/bin (careful, this will remove everything installed to your local bin folder, which might include previously installed applications).
For more info of all the impacted files and directories this link.
unstack doesn't clean out /opt/stack. or purge all dependency packages. or clean all eggs out of python.
I recommend running devstack in a VM. It's easy enough to simply remove the VM and rebuild from scratch.
Example shell script for creating a devstack VM for kvm:
#!/bin/sh
/usr/bin/vmbuilder kvm ubuntu -v --suite=oneiric --libvirt=qemu:///system --flavour=server --arch=amd64 --cpus=2 --mem=4096 --swapsize=2048 --rootsize=30480 --ip=192.168.122.236 --hostname=devstack --user=stack --name=stack --pass=stack --addpkg=git --addpkg=screen --addpkg=vim --addpkg=strace --addpkg=lsof --addpkg=nmap --addpkg=subversion --addpkg=acpid --addpkg=tcpdump --addpkg=python-pip --addpkg=wget --addpkg=htop --mirror=http://us.archive.ubuntu.com/ubuntu --components='main,universe' --addpkg=openssh-server --dns=8.8.8.8 --dest=/virts/devstack

PHPUnit: Warning: require(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 42

when running
phpunit
I get error
Warning: require(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 42
Fatal error: require(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.:') in /usr/local/bin/phpunit on line 42
/usr/local/bin/phpunit displays the following on line 42:
require 'PHPUnit/Autoload.php';
any suggestions how to fix this?
Update (1):
I was missing php.ini in /etc/, so I symlinked it to read the MAMP php.ini. Now I get
php -r 'foreach (explode(":", get_include_path()) as $path) echo $path . PHP_EOL;'
.
/Applications/MAMP/bin/php/php5.3.6/lib/php
/usr/local/bin/pear
/usr/local/share/pear/PHPUnit
running
phpunit
is running but provides no output.
Any suggestions what to check next?
Update (2):
probably the root cause of this issue is related to question
MAMP PEAR configuration is pointing to local directories.
I hit a similar issue on MAC OSX Lion. I installed phpunit with the PEAR package manager, and when I try to run it I got the error as described by udo. I was able to resolve it with the following simple steps:
Get the latest php archive of pear curl http://pear.php.net/go-pear.phar > go-pear.php
Install the archive with sudo php -q go-pear.php
During installation, it detects if the include_path in your php.ini does not contain the PEAR PHP directory. You can choose to let it fix it for you automatically when given the option.
I ran into this problem when I was running phpunit.phar from my local directory, but also has PHPUnit installed as a composer dependency. Removing the PHPUnit composer dependency fixed my problem.
You must have the folder that contains the PHPUnit source files on your PHP include path. Also, PHPUnit/Autoload.php was added in 3.6, and it's possible you have an older 3.5.x source folder instead. Check the folders listed using
php -r 'foreach (explode(':', get_include_path()) as $path) echo $path . PHP_EOL;'
(or on Windows)
php -r"foreach (explode(':', get_include_path()) as $path) echo $path . PHP_EOL;"
and make sure one of them contains a PHPUnit folder with Autoload.php.
Update: Regarding your update, you probably want to remove /usr/local/share/pear/PHPUnit from the include path because you're including PHPUnit/Autoload.php which should be located in /usr/local/share/pear which is already in the include path.
To make sure PHPUnit is working first run phpunit --version so you can see the installed version. PHPUnit instantiates all of the test cases it plans to run before outputting anything. If any of your test cases cause a fatal error while loading, sometimes no output is shown at all. This is very frustrating. Start by creating the simplest test case possible that doesn't use any of your code.
class MyTest extends PHPUnit_Framework_TestCase {
function testThatItWorks() {
self::assertTrue(true);
}
}
Running this test should produce a single passing test. Try it and paste what you see in your question.
To add to the previous answers: double-check with php.ini file is being loaded and make sure you edit THAT file with additional paths. I used the following to check the loaded php.ini
php -r 'phpinfo();'
Which told me that the loaded php.ini file was /private/etc/php.ini
Then I used "which" to tell me where phpunit had been installed:
which phpunit
Then I added that path to the php.ini file, so it ended up looking like this:
;***** Added by go-pear
include_path=".:/Users/admin/pear/share/pear:/php/includes:/usr/bin:/usr/lib/php/"
Only after I had done all that did the "phpunit --version" and other commands work as expected.
It should be noted that most users who face the problem faced here must be running the command
$ phpunit
from the command prompt. when they get the above error. What Most of us fail to understand about the real issue is that the PHP used on the command prompt will mostly be very different from the one running things for you in your webserver. Personally i use lampp and even though i had correctly installed phpunit using pear successfully,i failed to realised this essential part for hours.
Remedy
- for anytime you need to run a PHP script that requires resources in the include_path, make sure that php.ini for the respective PHP binary your using is adequately furnished. case and point in my ubuntu 12.04 installation with xampp my two php binaries include
the command line one i.e php5-cli found in /etc/php5/cli/ directory
the xampp one i.e php that is used by apache to serve my pages found in /opt/lampp/etc/php.ini
Both the php.ini files must have your desirable and correct include_path declaration for you to correctly bootstrap any command line scripts and serverside(apache served scripts).
Back to our matter at hand after correctly configuring the php.ini remember to
Restart Apache so that the web server pick your changes
Restart you terminal/commandline session so that the cli prompt picks your changes
Common Mistakes that get you problems when Changing Files in Linux/*nix Systems
remember to run chwon to own the php.ini file or else you wont even manage to edit them
remember to run chmod and change the values to allow you to save your changes after which you can return everything (access control on file i.e chwon and chmod to the previous state) to the way they were and it should be ok after restarting the terminal and apache.
Good Luck
The remark of Howard Lo on Mac OSX is very useful with the remark of Sebastian Perez. Because the remark is not that nice formatted, it maybe overlooked. After the Mavericks update of OSX I ran for the second time to this issue, U decided to create this full Apple OSX solution for this problem. I have to say I have also installed MAMP-PRO with several different version of php, so I need to be very accurate.
Check if you have an php.ini installed into /private/etc. If not issue the command:
$ sudo cp /private/etc/php.ini.default /private/etc/php.ini
Get the latest php archive of pear
$ curl http://pear.php.net/go-pear.phar > go-pear.php
Install the archive with
$ sudo php -q go-pear.php
During installation, it detects if the include_path in your php.ini does not contain the PEAR PHP directory. You can choose to let it fix it for you automatically when given the option.
After these steps I had to install phpunit again using the following commands:
$ sudo pear channel-discover pear.phpunit.de
$ sudo pear channel-discover components.ez.no
$ sudo pear channel-discover pear.symfony-project.com
$ sudo pear install phpunit/PHPUnit
Many thanks to Howard Lo and Sebastian Perez.

Resources