psycopg2 - Laravel Local Env - php

I am trying to get the psycopg2 module for python running in my Laravel application. It is working online on Heroku (I installed it there), but I am wondering about how I can get it running locally.
In Laravel I use:
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
Locally it throws this Error:
import psycopg2
ImportError: No module named psycopg2
On heroku, the code works properly, so it is just about the environment.
Does anyone know how to fix that?
PS: I use XAMPP locally
Thank you for your attention!

I'm running debian jessie and managed to get python 2.7 installed twice. When I specify the directory (/usr/bin/python or /usr/local/bin/python) I can make the "No module" error appear and disappear. Since I haven't seen this explanation before, I thought I'd share my experience. Seems strange that ALL the attempts at installation acted on the version in /usr/local/bin, while the PATH selects the version at /usr/bin. I think I will try removing the one at /usr/bin. Hope this helps someone.

Related

Interface 'Monolog\ResettableInterface' not found when running a new project

Whenever I try to run any command related to php artisan or composer this error shows up:
PHP Fatal error: Interface 'Monolog\ResettableInterface' not found in path\to\project\root\vendor\monolog\monolog\src\Monolog\Logger.php on line 28
I open the file, and it points me to :
class Logger implements LoggerInterface, ResettableInterface
I try to find the Logger interface and it's there.
I really can't find any other solutions and the ones recommended here by SO are outdated.
I use laravel 5.7 running composer version 1.8.0 on a xampp server with PHP 7.2.10 on Windows 10
Please feel free to ask more questions and I'll try to answer them without ruining my NDA.
Update: it works now thanks to that one person who answered.
If anyone needs this solution, you can do what Saumini Navaratnam suggested; removing the vendor folder and running composer update on the root folder. I, myself found another solution that might work and it is: running composer update --no-dev as the ResettableInterface came from a dev dependency. Weird, but it works fine now.
Again this works only on Laravel 5.7, at least for now.

Trying run working Laravel project on my PC via XAMPP

I have a whole project with database, everything is working here.
Project with database
I would like to run website so I can see changes I have made.
Im using XAMPP. My configs for VirtualHost hosts and http-vghosts.conf
I have tried this https://youtu.be/iXYCnYRalaw?t=2m13s ->> from [2:13] to [4:22]
using XAMPP, but still cant run it.
Can you give me any advice or steps how to make website run on my PC? [ofcourse just for me (VirtualHost)].
Editor using: Atom
My PC spec
If running laravel appliation inside XAMPP htdocs folder is really necessary, then could you provide some kind of error, simply telling "it doesn't work" doesn't help at all.
One thing you can try is to open command prompt inside laravel folder and run
php artisan serve
This will open local server that runs current project in:
http://127.0.0.1:8000
Also, checking laravel minimum requirements is something you should check out. 5.5 requires PHP 7 and you didnt tell what XAMPP version you are running.

Eclipse MakeGood Error: PHPUnit_Framework_TestCase class is not available

I've been having an issue setting up XDebug (2.6.0) to work with PHPUnit (6.0.13) in Eclipse Neon (4.6.3). I've had XDebug working within my browser, and have had PHPUnit working from the command line, however am unable to get the two working together.
I'm working within a Vagrant VM running Ubuntu, with OSX as my main system.
XDebug is installed globally through Vagrant and PHPUnit is installed via Composer. In my Project Settings, I have pointed a PHP Executable to /usr/bin/php, using the system default .ini file., however this is the file on my machine, rather than the file on the VM, so I don't know if I need to adjust this, but nothing I read mentioned it?
The issue I am having is that my 'MakeGood' tab is showing the error 'PHPUnit_Framework_TestCase class is not available. Fix...' even though I have included the vendor/autoload.php file within the Project Preferences. I have also tried setting up a custom library pointing towards the vendors/ folder, as I saw suggested on a blog post, however it didn't help anything. So any suggestions as to what else to try would be greatly appreciated.
I've tried looking around on here and further across the web, and most of the resources I can find talk only about setting it up referencing through PEAR, however that obviously doesn't work with Composer.
As always, thanks for any help you can provide.
Edit: Just in case it makes any difference, my tests are stored in tests/, with the namespace \App\Test and my classes in resources/src/ with the namespace \App.

Run Laravel on existing Apache server

I have a DigitalOcean server running Ubuntu 14.04. I'm using this as a host for my web-development projects.
Now I want to start using Laravel for a project of mine, but I have a question about this.
In the /var/www/html folder of Ubuntu I created a folder, let's say, "project". In this folder I installed Laravel using this tutorial. Now everything is setup I want to run Laravel so I can test it and start developing on it.
When I run the command php artisan serve from within the "project"-folder it says "running on http://localhost:8000". So it's working.
But how do I access it? When I go to http://example.com/project it just shows me the files in that folder.
So it's running on the localhost on my server. Does that mean that it is external-accesible (the url above) or how does this work? (I guess the port is also different, 8000 instead of the default 80 for Apache)
I hope the question is clear and someone can help me out.
I have a Laravel project up and running on Digital Ocean with the Ubuntu 14.04 x64 vmlinuz-3.13.0-24-generic (1221) kernal.
I don't think you should be using php artisan serve for this purpose, as that is more for your local computer if you would like to preview your webpage if you don't want to use Apache.
To get set up, I used the excellent below instructions that were incredibly helpful. As you can see, there are many steps that you should carefully follow to get things up and running.
https://github.com/susanBuck/dwa15-fall2016-notes/blob/master/01_Servers_and_Git/07_Deploy_to_Digital_Ocean.md
Let me know if that helps you, and feel free to follow up with more questions if you get stuck on a step.

Laravel 4 Installation Error (via composer) always Timeout

I tried installing laravel.
I installed xampp then the composer.
I followed the documentation but when i'm installing laravel, i always get this:
http://i975.photobucket.com/albums/ae238/Mochi_Ongpin/help_zpsb8870025.png
Can someone please help me? I already tried several times but failed.
Your Laravel is already installed, it timed out in the very last thing it does, which is create the compiled classes files bootstrap/compiled.php. If this file is present, delete it (it's not really necessary) and try to use your Laravel installtion.
Why is it timing out? Not sure, but you can, later, try to execute the command manually:
php artisan optimize
EDIT:
You successfully installed a Laravel application, but there is at least one other variable in this process: a web server. Without it you cannot see that success message.
Being on Windows you probably will have to install Apache 2 or WAMP, then create a Virtual Host for your Laravel application and hit: http://localhost/ to see that message.
You can also try to use Laravel's internal PHP server:
php artisan serve
And in your browser go to
http://localhost:8000

Categories