Installing Symfony on Mac OS X - symfony

I am having trouble installing this framework.
I entered this command on terminal as per the instructions on http://symfony.com/doc/current/quick_tour/the_big_picture.html. This was from the desktop.
$ php -r "readfile('http://symfony.com/installer');" > symfony.phar
The next part requires me to add this code:
$ sudo mv symfony.phar /usr/local/bin/symfony
Now I get this error:
mv: rename symfony.phar to /usr/local/bin/symfony: Not a directory
Please help me resolve this.

Try and move it to /usr/bin instead.
The directory you're trying to move it to doesn't exist. The instructions you're following may not be intended for OS X users.
The executable can go anywhere that's in your PATH.

Related

karaf: JAVA_HOME is not valid: /usr/lib/jvm/java-11-openjdk-amd64/bin/java [duplicate]

I am working in Ubuntu 16.04. I need to install gradle and the gradle is installed when i checked with sudo apt list --installed command but when i use gradle -version command it shows the following error,
JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oracle/jre/bin/java
In sudo vim /etc/environment file,
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
http_proxy="http://username:password#IP:port no/"
https_proxy="https://IP:port no/"
ftp_proxy="ftp://IP:port no/"
I don't know where i made mistakes. Please help me.
Thanks.
On a 64bit openSuse 64 42.1 box;
readlink -f $(which java)
provided;
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java
But;
export JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
is the path that worked and allowed java emulator to run.
So i think we have to manually browse our file system and see what path to choose.
Today I faced this problem. I am using the default java that comes with your linux distro (so in my case, linux mint).
$ whereis java
This command gave me
java: /usr/bin/java /usr/share/java
So, I opened /user/bin. There was a link to Java. I right clicked it and selected follow original link. This lead me to /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
So now that I know where this java is, I opened my .bashrc file, and edited the JAVA_HOME.
So for my case,
## My Custom variables
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
This solved the problem.
Now if you are using some other java (say you downloaded from oracle and extracted the zip file ...), then you have to add that location. So for example, if your java is in /home/user/.sdkman/candidates/java/current, then
export JAVA_HOME=/home/user/.sdkman/candidates/java/current
export PATH=$JAVA_HOME/bin:$PATH
I see a mismatch. In your enviornment file the JAVA_HOME is set to "/usr/lib/jvm/java-8-openjdk-amd64/" and your mentioned that the error that you got relates to the JAVA_HOME as "/usr/lib/jvm/java-8-oracle/jre/bin/java"
If you JAVA is really installed in /usr/lib/jvm/java-8-oracle directory, then you need to ensure that the JAVA_HOME is set to that directory. And also your PATH reflects $JAVA_HOME/bin in it.
I typically install Oracle JDK/JRE separately in a separate directory such as /usr/local/jdk1.8.0 etc.
check the jvm installtion folder from Files
eg : /usr/lib/jvm/java-12-oracle
then in terminal run sudo nano /etc/environment and add the line
JAVA_HOME="/usr/lib/jvm/java-12-oracle"
Then open terminal and run
export JAVA_HOME="/usr/lib/jvm/java-12-oracle"

Unable to install namerctl

I have the following version of go on my ubuntu, I am unable to install namerd, Please find the image below.
go version go1.6 linux/amd64
Running go get -u github.com/linkerd/namerctl will install the executable into your $GOPATH/bin directory. You need to make sure that directory is included in your shell's $PATH in order to use namerctl from the command line.

php-cs-fixer got broken for linux users after fixing the issue 6 for windows users

I use Linux Ubuntu 16.04. I have well installed php-cs-fixer for atom 1.9.8.
$ php-cs-fixer
PHP CS Fixer version 1.11.6 by Fabien Potencier
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
fix Fixes a directory or a file
help Displays help for a command
list Lists commands
readme Generates the README content, based on the fix command help
self-update Update php-cs-fixer.phar to the latest version.
selfupdate Update php-cs-fixer.phar to the latest version.
The problem comes with config of php-cs-fixer with atom. In fact, package requires:
a PHP Executable path (which is by defaut php) (for linux user it must be empty which is not possible with actual version of the package) (see isse #6 )
a PHP-CS fixer Executable path (which is simply for linux user php-cs-fixer (without the use of PHAR file))
Consequently, when I run php-cs-fixer from atom I get this error: Could not open input file: php-cs-fixer.
I can generate this error message with this console command:
php php-cs-fixer fix Class.php
Could not open input file: php-cs-fixer
So, can you make PHP Executable path optional (not compulsory) for that package of atom???
thanks,
Update on this issue:
I managed to download php-cs-fixer.phar from https://github.com/FriendsOfPHP/PHP-CS-Fixer and I put it in the folder ~/.composer/ so that:
a PHP Executable path is php
a PHP-CS fixer Executable path is: ~/.composer/php-cs-composer.phar
But now I am getting this error: Could not open input file: ~/.composer/php-cs-fixer.phar
So what's wrong??
For you information, running the console php ~/.composer/php-cs-composer.phar Class.php command is successful.
The solution is found on github:
a PHP Executable path is php
a PHP-CS fixer Executable path is: /home/username/.composer/php-cs-composer.phar and don't use the ~ in atom.

Meteor.js installation failed

I wanted to install Meteor via
curl https://install.meteor.com | /bin/sh
like it's said in the documentation.
Every time I try this (also as sudo), I get this error:
**rmdir: /Users/christophz/.meteor-install-tmp: Directory not empty
Installation failed.**
The directory, of course, is empty before installation. After aborting the installation in my home folder there IS .meteor and still .meteor-install-tmp. But trying to create a new meteor app fails. My command line says it doesn't know this command.
I didn't find anything via Google. Can u help me and give me some hint?
Did you try rm -rf? With or without sudo:
rm -rf ~/.meteor-install-tmp
rm -rf ~/.meteor
Try deleting the directory. I think this happened to me once.

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