0


I have a problem during Propel ORM configuration.
I prepared environment on my Vagrant with PHP 7.1 following this provision file:

# Install software
add-apt-repository ppa:ondrej/php
apt update
apt install python-software-properties
apt update

apt install -y apache2
apt install -y php
apt install -y php-mcrypt
apt install -y php-mysql
apt install -y php-curl
apt install -y php-cli
apt install -y php-xml
apt install -y libapache2-mod-php
apt install -y mc

# install composer, configure Apache and create database

service apache2 restart
/etc/init.d/mysql restart

Currently I want to install Propel ORM. I added Propel to composer, installed, and now I type (by SSH in Vagrant) /var/www/application/Vendors/bin/propel init but unfortunately I get error:

/usr/bin/env: �php\r’: No such file or directory

What can I do to resolve it?

EDIT: File that I run (not edited, installed via Composer):

#!/usr/bin/env sh

dir=$(d=${0%[/\\]*}; cd "$d"; cd "../propel/propel/bin" && pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
    # Cygwin paths start with /cygdrive/ which will break windows PHP,
    # so we need to translate the dir path to windows format. However
    # we could be using cygwin PHP which does not require this, so we
    # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
    if [[ $(which php) == /cygdrive/* ]]; then
        dir=$(cygpath -m "$dir");
    fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/propel" "$@"
Dapi
  • 1
  • 2
  • You might check the file you run first: the file literally contains those funny characters. – zerkms Mar 19 '17 at 01:04
  • It is not appropriate to repeat the tag information in your title. The tag system works extremely well here and does not need your assistance. – Ken White Mar 19 '17 at 01:23
  • @Dapi Welcome to SO Dapi. Always add new information about your question directly into you question by editing it -- not by adding comments. This will allow future readers to access all of the necessary information without having to comb through the comments. Please edit your question and delete your comment. – mickmackusa Mar 19 '17 at 01:58

1 Answers1

1

I don't use propel but had the same problem with phpunit.

The problem is often that the vendor/propel/propel/bin/propel, or in my case the vendor/phpunit/phpunit/phpunit file you try to execute is Windows encoded and not Unix encoded. It happens when you do composer install/update on Windows but run your code in a vagrant box.

You have multiple ways of getting rid of the CRLF:

  1. dos2unix command (sudo apt-get install dos2unix)
  2. use your prefered text editor (Sublime, PHPStorm, they can both do that)
  3. get rid of vendor and run composer install/update from your vagrant box

Remember that the problem is not the vendor/bin/propel file but the vendor/propel/propel/bin/propel file.

Hope this help!

Eric Jeker
  • 487
  • 6
  • 7