Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

609
Views
Tinker artesanal de Laravel de Amazon Linux 2 (Elastic Beanstalk)

Solía ejecutar tinker en Amazon AMI anterior usando este comando:

 sudo -E -u webapp php artisan tinker

Ahora estoy usando PHP 7.4 on Amazon Linux 2 y cuando ejecuto el comando anterior, aparece este error:

 Unable to create PsySH runtime directory. Make sure PHP is able to write to /run/user/1000 in order to continue.

Entonces, para probar, otorgué el permiso completo a esta carpeta y luego ejecuté mi comando nuevamente:

 sudo chmod 777 /run/user/1000 sudo -E -u webapp php artisan tinker

En realidad, no hay error, pero las variables de entorno como RDS_PASSWORD o RDS_DB_NAME no se cargan, lo que hace imposible realizar acciones en la base de datos:

 Psy Shell v0.10.4 (PHP 7.4.4 — cli) by Justin Hileman >>> env('RDS_DB_NAME') => null >>> User::first() Illuminate/Database/QueryException with message 'SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` limit 1)'

También traté de hacer echo de la variable desde un shell, obtuve el mismo resultado:

 sudo su webapp sh-4.2$ echo $RDS_DB_NAME # Empty here
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

No está en la documentación, pero las variables de entorno están en /opt/elasticbeanstalk/deployment/env

Así que puedes hacer algo como esto:

 export $(sudo cat /opt/elasticbeanstalk/deployment/env) && sudo -E -u webapp php artisan tinker

Además, para lidiar con el problema de PsySH , simplemente cree un archivo .psysh.php en su directorio de código fuente con ese contenido:

 <?php return [ 'runtimeDir' => './.psysh', ];

Psysh luego usará ese directorio sin ningún problema de permisos porque la webapp lo posee.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!