Laravel Sail Stopped Working with "bad variable name" - laravel-9

Suddenly all sail commands stopped working with an error
vendor/bin/sail: 26: export: PROJECTS/Laravel9/myproj/vendor/bin: bad variable name
Line 26 on vendor/bin/sail has:
export COMPOSER_RUNTIME_BIN_DIR=$(cd "${self%[/\\]*}" > /dev/null; pwd)
What is the reason and how can I recover? Thanks!
I am using
Windows 10
WSL2 (Ubuntu 20.04)
Docker Desktop

I found out that my folder name has the space IT PROJECTS. Somehow the IT part was not included in the export.
Renaming my folder to PROJECTS solved the problem

Related

Symfony 5 - "An exception occurred in driver: could not find driver"

I'm currently face to this problem. I am really new beginer at Symfony.
Problem :
When i create a new db with cli symfony console doctrine:database:create, i am getting these errors :
In AbstractPostgreSQLDriver.php line 102:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 38:
could not find driver
Iam using php 7.4 with xampp and normaly pdo_sql is installed :
extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
this is my .env file config :
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
DATABASE_URL="mysql://root:#127.0.0.1:3306/dbname"
DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###
And this is my doctrine.yaml file config :
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
I have been searching for hours but i cant get any solutions to solve my problem, someone has an idea ?
I'm on windows.
Thanks a lot !
If you want to use Mysql , comment this line DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
If not comment the other line
if you are working in Linux, probably some extensions are missing,run those command
sudo apt-get install php-mysql php-pdo
I had the same problem, PHP 7.4.29, xampp, windows.
For the purpose of installing Xdebug I upgraded my PHP version to 7.4.29 (previously 7.4.18), and I guess this errror occured since then. Database connexion worked before. I copied the extensions from the old php.ini to the new one and the error remained.
What resolved the problem : added this line :
extension_dir = "D:\programs\xampp\php\ext"
And activated these extensions :
extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
extension=mbstring
extension=exif
extension=mysqli
extension=pdo_mysql
extension=pdo_sqlite
In my case, I got my .env.local file from a colleague and stupidly saved it without the leading dot, so Symfony was using the values from the .env file, which reads
DATABASE_URL="postgresql://symfony:ChangeMe#127.0.0.1:5432/app?serverVersion=13&charset=utf8" rather than the correct DATABASE_URL="mysql://foo:bar#127.0.0.1:3306/baz?serverVersion=mariadb-x.y.z" from .env.local.
I'm running Homestead/vagrant on windows and my problem was, I wasn't able to execute this command php bin/console doctrine:database:create on windows even though I opened a terminal as administrator
As seen on these 2 pictures I tried Cmder and Git bash and both of them failed, saying an execption occured in driver: could not find driver
I then solved it by SSH into my vagrant box vagrant ssh navigated to the working symfony folder and ran the command from there php bin/console doctrine:database:create and for some reason that worked !
I wish there was an easier way to debug this stuff, but I guess that's how it is working with Windows. Hope this can help someone out there
php.ini
copy path
find the file then open it
delete the ; in extension=mysqli
I also had this problem, just uncomment the DATABASE_URL that you have on your computer either (sqlite, mysql or postresql).
I had the same problem when I typed the following command:
symfony console make:user User
I solved the problem with the command:
php bin/console make:user User.
Wanting to create a user
step 1 => go to Xaamp control panel then click config of Apache
step 2 => click on PHP(php.ini).browse through the file. you can able to see these extensions.
extension=bz2
extension=curl
remove ; from ;extension=pdo_pgsql and save it and close file
step 3 => now come back to your project.click on .env file and comment this line:
DATABASE_URL="postgresql://symfony:ChangeMe#127.0.0.1:5432/app?serverVersion=13&charset=utf8"
this works!
I had the same problem, I am runing a Symofny application with docker.
When you add doctrine-bundle to your app, in Dockerfile will appear this lines what will install drivers for postgres.
You have to remove it and add this line, this will install drivers for mysql
RUN docker-php-ext-install pdo pdo_mysql
I hope that helps to someone.
Delete or comment from .env file the line:
DATABASE_URL="postgresql://db_user:db_password#127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
I had the same problem to solve the problem:
type php --ini to see the path to the file php.init
if you are on vscode do ctr + click on the path otherwise follow the path manually on your computer to the file php.init make sure your open php.init file with admin right !!
edit the file and uncomment extension=pdo_mysql
save and retry php bin/console doctrine:database:create
type php -m for check if your're in list pdo_mysql
here an illustration

Move from xampp to Laravel Homestead: installation and opening projects

I want to move two Laravel projects from xampp local environment to Homestead environment.
I followed laravel instructions, set up homestead and created a new project. However,getting an error message when trying to access ssh vagrant in the second homestead folder.
My new installed laravel project is in directory C:\Projects\Project
My homestead was installed in directory C:\Users\tom\Projects_lar\Homestead
For my first project I went to "vagrant ssh" through gitbash and created a new laravel project from there and automatically it appeared also in C:\Projects
Then I tried to git clone a second project after typing SSH vagrant, but the second project did not appear.
So then I created one more homestead and one more laravel project:
C:\Projects\Project2
C:\Users\tom\Projects_lar\Homestead2
Then I could run two laravel projects at the same time, but
I cannot access vagrant ssh in homestead2, it says:
A VirtualBox machine with the name 'homestead' already exists.
Please use another name or delete the machine with the existing
name, and try again.
I also tried to replace files inside C:\Projects\Project with files from my project in local xampp environment, but got an error:
! ) Warning: require(/home/vagrant/Project_lar/Project1/vendor/composer/../symfony/polyfill-ctype/bootstrap.php): failed to open stream: No such file or directory in /home/vagrant/Project_lar/Project1/vendor/composer/autoload_real.php on line 66
Call Stack
Time Memory Function Location
1 0.0016 401952 {main}( ) .../index.php:0
2 0.0049 402216 require( '/home/vagrant/Project_lar/Project1/vendor/autoload.php' ) .../index.php:24
3 0.0054 402896 ComposerAutoloaderInitf2c3bc37946cfa48d88d179975fa8f9f::getLoader( ) .../autoload.php:7
4 0.0077 407496 composerRequiref2c3bc37946cfa48d88d179975fa8f9f( ) .../autoload_real.php:56"*
I am not very good with virtual set ups yet. Questions:
How should I set up 2 new laravel projects?
How do I replace those two projects with my actual projects which currently I have in local xampp environment?
Update: I tried to edit project and project 2. It seems to be one and the same project, not two projects.
I am on windows 10.
Homestead aims to be a singular virtual machine that allows you to develop all your projects. You do not need to create an entirely new vagrant box instance for every project, instead I would encourage you to use shared folders. Please see the documentation.
Essentially, you are creating a folder that both the the host and the guest OS may use. The steps for adding a shared folder are as follows (explained in more depth in the docs as well):
Edit the Homestead.yaml and add your desired path, for example like so:
folders:
- map: ~/code/project
to: C:\Projects\project
Then you must run the command vagrant --provision in the homestead folder to let these changes take effect.

Redhat with httpd24 connecting to Informix using DBI

I'm at my wits' end on this. I have 2 RH7 boxes that I just installed httpd24 (v2.4.34) on. They were running httpd (v2.4.6) without any connection problems. Now when I try and run Perl scripts from the browser, they fail with...
install_driver(Informix) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Informix/Informix.so' for module DBD::Informix: libifsql.so: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
at (eval 5) line 3.
Compilation failed in require at (eval 5) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /var/www/html/app/cgi-bin/test_informix_odbc.cgi line 35.
But when I run the same script from the command line, as 'apache', it runs just fine. All the ENV vars are set correctly.
Anyone run into anything similar before?
It would no longer use the LD_LIBRARY_PATH environment variable I was setting in httpd.conf.
Services are started in a fresh environment without any influence of user's environment (like environment variable values). As a consequence, information of all enabled collections will be lost during service start up.
Newer versions of httpd have stopped bringing the user environment in when the service is started. I found this little blurb in /opt/rh/httpd24/service-environment.
grep -r "LD_LIBRARY_PATH" /opt/rh/httpd24/
/opt/rh/httpd24/enable:export LD_LIBRARY_PATH=/opt/rh/httpd24/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
I prepended the standard informix paths in /opt/rh/httpd24/enable.
export LD_LIBRARY_PATH=/opt/IBM/informix/lib:/opt/IBM/informix/lib/esql:/opt/rh/httpd24/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
And everything is back to normal. Woohoo!

The local psql command could not be located

I'm following the instructions found here.
When I try to run $ heroku pg:psql or $ heroku pg:psql HEROKU POSTGRESQL_BROWN I recieve the following error message:
! The local psql command could not be located ! For help
installing psql, see local-postgresql
I can't find anything useful on the link it gives me (it just links to the instructions I was already using, but further down the page) nor can I find this error anywhere else.
If I've missed anything you need to know to answer this, just let me know. I'm rather new to all this and teaching myself as I go.
I had same error even after installing Postgres locally.
But after seeing this
I saw that "pqsl" was not in the PATH so I then did
PATH=%PATH%;C:\Program Files\PostgreSQL\9.2\bin
which worked for me
I have since solved this myself. When I ran heroku pg:info it says the version number is 9.1.8, I was locally running 9.2
installing 9.1.8 and ensuring Path pointed to the appropriate folder solved the problem.
After you change the path, make sure to restart the terminal!
Set the PATH. To find out the PATH of your psql script (on mac) open the sql shell script from your finder in Applications/Postgres installation. This will give you a hint as to where it is installed. That opened a window which told me it is located here: /Library/PostgreSQL/8.4/scripts/runpsql.sh
Then, I set the PATH variable from the terminal window by typing:
$ PATH="/Library/PostgreSQL/8.4/bin:$PATH"
(depends on the location of your PostgreSQL installation, find your bin path first, another exp: /usr/local/Cellar/postgresql#9.6/9.6.8/bin)
OR.....
You can also connect to the shell by opening the shell directly from your postgres installation folder. Then enter the credentials. If you don't know the credentials, here is how to find them out:
$ heroku pg:info
=== HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)
$ heroku pg:credentials HEROKU_POSTGRESQL_RED_URL
Top answer wouldn't work for me oddly, my system would not add the Path via cmd with administrator access (Not sure why).
So check this > Windows key > environment variables > system variables
And add the last line (your version may differ in the path)
Make sure you've installed the toolbelt as psql is installed by default.
However you also need to ensure you've installed a local copy of PostgreSQL; if you don't the toolbelt will be unable to find the native psql client.
Assuming you have installed a local copy of PostgreSQL, make sure you can execute psql from the command line directly (i.e make sure you PATH is set correctly ). If the command does not execute, check your PATH, if it does execute see if you can connect via the PSQL connection string provided in the Heroku control panel. If you can connect reinstall the toolbelt, if you are unable to connect provision another dev database and try again.
If there are still issues, I would suggest contacting Heroku support for assistance after verifying no API issues are listed on the status page located here.
I got rid if this annoying message on Windows by adding a path element without the spaces, i.e.
C:\Progra~1\PostgreSQL\9.4\data
instead of
“C:\Program Files\PostgreSQL\9.4\data”
I followed the instructions here: http://www.computerhope.com/issues/ch000549.htm, which worked for me if you prefer to go the point-and-click configuration of the PATH variable.
This type of error usually appears in the Windows environment, because if you do not update the PATH after installing Postgresql, heroku pg:psql command does not work.
So you need to update your PATH environment variable to add the bin directory of your Postgres installation. The directory will look like this:
C:\Program Files\PostgreSQL\<VERSION>\bin.
For more information, go to the Heroku in Local setup website:
heroku-postgresql: Local setup
I had the same problem and discovered that Heroku doesn't seem to provision the latest version of PostgreSQL by default. Where the Heroku Getting Started instructions said
heroku addons:create heroku-postgresql:hobby-dev
That provisioned a v10 database for some reason (which you can check by clicking on Heroku Postgres in the Add-ons tab of your dashboard). I deleted that database and provisioned a new database using the --version flag:
heroku addons:create heroku-postgresql:hobby-dev --version 11
As of now, at least, you can find the latest version of Postgres supported by Heroku at this link: https://devcenter.heroku.com/articles/heroku-postgresql#version-support-and-legacy-infrastructure
I'm writing this in early 2019, but according to the PostgreSQL website the next version (12) is "tentatively scheduled" for third quarter of 2019 so if you're reading this in late 2019 potentially the same problem will come up for v12 instead
On Mac you can use the following:
export PATH="/Library/PostgreSQL/12/bin/:$PATH"
The only solution that I found on Windows:
go to advanced system settings
go to environment variables
select Path variable and click Edit
add a new line and enter your bin directory path (C:\Program Files\PostgreSQL<version>\bin) and click ok
restart your terminal
enter your psql command (heroku pg:psql)

Tomcat - The system cannot find the file specified

I downloaded Tomcat 6 from Tomcat Website and try to install. I found the .exe file in C:\apache-tomcat-6.0.35\bin but when i run the exe file the command prompt disappeared after show "The system cannot find the file specified". I already installed JDK 6 update 29 in my system. Please advice
I had a simmilar problem after installing a java update, but JAVA_HOME was set correctly. If you run tomcat as a service, you might have to right click on the tomcat icon and open java tab and change java virtual machine path or just set "use default".
If I were to "guess" I would say that the JAVA_HOME is not set. But to confirm :
Can you go the command line, make sure that JAVA_HOME is set correctly, startup tomcat (from command line) ? If you run into errors, please send the text output.
Try to run "startup.bat" to start a tomcat instance.
Go to your/path/tomcat and execute script catalina_start.bat .I had the same issue and this worked for me (though I installed Tomcat as a part of XAMPP package)