How do I get laravel to work on local host from pagodabox? I've installed laravel 4 through pagoda box, then cloned it to localhost. I then ran composer install to get all the dependencies and updates. When I try to navigate the URI to the public directory, it doesn't show me a "you have arrived" screen. Instead I get the following error message:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. [tcp://tunnel.pagodabox.com:6379]
I then looked in "database.php" and noticed that the redis array was modified, so I copied the same one from a fresh installation of Laravel, but then I got the following error:
No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]
I Had the same problem, just change the bootstrap > start.php file, search for
'local' => array('your-machine-name')
and change it with your machine name.
This video help me to deal with that: http://www.youtube.com/watch?v=CJoU-LO8Ufo , in the video he changes it to the virtual host but that didn't work for me, i had to put my computer name.
On Mac the computer name can be found by typing hostname in the terminal.
Joshdcid's answer is right for some, but not all. I found this in my bootstrap > start.php file:
'local' => array('homestead')
..., and changing that variable in any way caused my laravel app to not load at all. Not only that, but in a fresh install of laravel, this local variable had the same value of 'homestead'.
After spending a bit of time in WinMerge, I found that you should use Wayne's tip of changing
'redis' => array(
'cluster' => false,
'default' => array(
'host' => 'tunnel.pagodabox.com',
'port' => 6379,
'database' => 0,
),
),
to
'redis' => array(
'cluster' => false,
'default' => array(
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
),
),
at the bottom of the app > config > database.php file, then you should also go to the top of the
app > config > session.php file and change
'driver' => 'redis',
to
'driver' => 'file',
..., just as a fresh install would have. You should be able to view your app now!
Related
I am using two Docker container, one having ubuntu and an apache webserver running, the other one a mysql server. The containers are linked and i can connect from the ubuntu container onto the mysql server. For the connection I use in the ubuntu container:
mysql -u root -h mysql
where the second 'mysql' is the name of the container. I can connect to it through the container id as well, so the connection works as well as connecting onto the database from the windows environment.
What doesnt work is the connection from doctrine to the database within the PHP application which is in the ubuntu container.
The config looks like this:
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'mysql',
'port' => '3306',
'user' => 'root',
'password' => '',
'dbname' => 'db_name',
'charset' => 'utf8',
)
)
),
)
But I get the Error message
Uncaught PDOException: could not find driver in /var/www/vendor/zendframework/zend-servicemanager/src/ServiceManager.php
and
Zend\ServiceManager\Exception\ServiceNotCreatedException: An abstract factory could not create an instance of doctrine.entitymanager.ormdefault(alias: doctrine.entitymanager.orm_default). in /var/www/vendor/zendframework/zend-servicemanager/src/ServiceManager.php
Does anyone have any idea how to solve this and where exactly the error comes from?
I have already tried to put in the container ID as 'host' and commented out the 'password' field as it is not used.
Thanks in advance
Jonathan
You need to have pdo_mysql allowed on your system, it doesn't seem a connectivity issue but a php configuration problem.
Can you try to do this command inside your php container
php -i | grep pdo_mysql
Just to understand if php has this module
I am working on building a Zend Framework 2 (ZF2) website using Doctrine2 DBAL/ORM, where I develop equally on Windows and Mac, sometimes Linux (Ubuntu) (I like the all-around experience).
In composer.json I have the following versions:
"doctrine/doctrine-orm-module": "^0.9.1"
"zendframework/zendframework": ">=2.3.2,<3.0.0"
At first, my website ran fine on all three environments using XAMPP (Apache 2.4.16, MySQL 5.0.11, and PHP 5.6.12). But suddenly, after I performed some changes on Windows and pulled those changes from GitHub to my Mac computer, Doctrine started failing with the following exception message:
An exception was raised while creating "Doctrine\ORM\EntityManager"; no instance returned
I got this exception a lot while configuring Doctrine2 in ZF2. But once I was done, things just worked. That is until it broke on Mac, only! It still works fine on Windows.
I have cleared the cache completely (rm data/cache/*) and I have verified the integrity of my configuration files. The only difference in configuration between Windows and Mac is that I provide a unix_socketpath for MySQL (see below).
My config/application.php:
<?php
return array(
'modules' => array(
// ...
'DoctrineModule',
'DoctrineORMModule',
),
'module_listener_options' => array(
// ...
),
);
My config/autoload/databases.local.php looks like this (with changed values for database server login information):
<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'unix_socket' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock', // This is for Mac
'host' => 'some_host',
'port' => '3306',
'user' => 'some_user',
'password' => 'some_password',
'dbname' => 'some_database',
)
)
),
'configuration' => array(
'orm_default' => array(
'proxy_dir' => 'core/server/data/DoctrineORMModule/Proxy',
'proxy_namespace' => 'DoctrineORMModule\Proxy',
)
)
),
);
As mentioned, these configurations work on Windows (I can retrieve and use the EntityManager) and is a 1:1 mirror onto my Mac solution. So what happens?
When I check the cached configuration file, data/cache/module-config-cache.application.config.cache.php, on my Mac, the database login informations are incorrect, having the following values:
// ...
array (
'host' => 'localhost',
'port' => '3306',
'user' => 'username',
'password' => 'password',
'dbname' => 'database',
),
// ...
Obviously these are wrong. But how can ZF2 suddenly generate incorrect configurations on Mac?
I even tried checkout out previous commits from Git on my Mac, which I know worked for certain. But the same problem occurs. The only difference, I suspect might have influence on this behavior, is that I ran composer.phar update, which might've changed the versions of ZF2 and/or Doctrine2.
The problem boiled down to the glob pattern for the autoload config files being incorrect.
$appConfig['module_listener_options']['config_glob_paths'][$index] = getcwd() . '/' . $path;
getcwd() had an incorrect pointer, despite having specified the following:
define('ROOT_PATH', realpath(__DIR__ . '/../../../..'));
chdir(ROOT_PATH);
For some reason I cannot fathom, it worked before on Windows and Ubuntu, but not on Mac. Now it works in all three environments.
It's an almost invisible error and required line-by-line debugging through the bootstrapping logic.
In my case, this error message were thrown, when the database was missing!
I am currently creating an app with Laravel and Redis. Almost everything is working fine. I extended the Authentication as explained in the documentation, users can subscribe, login, logout ... I can create content and everything is stored in Redis.
But I have one issue. I can't run commands like "php artisan route:list", I have an error message : "[InvalidArgumentException] Database [redis] not configured.".
Th question is, is there anything special to do to make Artisan commands work when you set Redis as you database ? (basic configurations explained in the documention have been done and almost everything else is working fine).
Config:
In config/database.php I have:
return [
...
'default' => 'redis',
...
'redis' => [
'cluster' => false,
//'connection' => 'default',
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 7,
],
],
...
PS : You have the same error when you try to access the /password/email (password reset url).
InvalidArgumentException in DatabaseManager.php line 246:
Database [redis] not configured.
As Robert says in the comments, it looks like there is this error because there is no support for Redis as database for laravel.
I am using MAMP on my MAC. As it comes with MySQL by default. But now I need to use PostgreSQL in one of my project. How can I setup postgreSQL in MAMP for Laravel project?
Ok if you are set on using postgreSQL over mySQL that comes with MAMP you have to manually install postgreSQL on you location machine the OSX packages can be found here,
If you don't want to do a full install i recommend this Postgres App just download an extract to your applications folder then when you launch it the port number will be displayed in the menu bar like so:
create a database:
go to menu above Click on Open psql
In the command line create you database like so: CREATE DATABASE your_database_name;
should return CREATE DATABASE
Tip to exit postgreSQL CLI use \q then ENTER
You now need to plug these settings into Laravels configuration:
open file: %laravel_directory%/app/config/database.php
in the array replace 'default' => 'mysql', with 'default' => 'pgsql',
now with the information from before edit the 'connections' array like so:
'connections' => array(
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'your_database_name',
'username' => '',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
)
save file
You should now have a functioning database that Laravel can talk to.
Note you do not need the username or password in database config if you are using the Postgres App.
I'm new to CakePHP and am just running through the configuration process, but am stumped why Cake can't access my MySQL database. The Cake info page says my tmp directory is writable, the FileEngine is being used for caching (don't know what this means), and my database configuration file is present, but that CakePHP cannot connect to the database.
Here are my setup details:
PHP 5.3 (pre-installed on Snow Leopard)
MySQL 5.1.40 64-bit
CakePHP 1.2.4.8284
Here are the steps I went through:
Created a MySQL schema called cake_blog
Created a MySQL user called cake_blog_user
Granted cake_blog_user the appropriate permissions on cake_blog#localhost and cake_blog#%
Copied the database.php.default file to database.php and edited the database connection details as appropriate
Here is the relevant configuration data from database.php:
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'cake_blog_user',
'password' => 'cake_blog_password',
'database' => 'cake_blog',
'prefix' => '',
);
Am I missing something here? I should also mention that if I insert an echo mysql_error(); into the /cake/libs/view/pages/home.ctp file right before it tests the database connection, the error displayed is "No such file or directory." I have no idea what file or directory it's talking about.
Thanks!
What usually bites me in it's that MySQL thinks of 'localhost' as 'connect thru the unix socket' and '127.0.0.1' 'connect thru TCP port'. With things like XAMPP (at least on mac) the unix socket file isn't there. Just use 127.0.0.1 instead.
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => '127.0.0.1',
'login' => 'cake_blog_user',
'password' => 'cake_blog_password',
'database' => 'cake_blog',
'prefix' => '',
);
Should work all the time.
If it is the socket, just edit /etc/php.ini to reflect the following
pdo_mysql.default_socket=/tmp/mysql.sock
and
mysql.default_socket = /tmp/mysql.sock
I believe you can also do the following
<?php
public $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'cake_blog_user',
'password' => 'cake_blog_password',
'database' => 'cake_blog',
'prefix' => '',
'port' => '/tmp/mysql.sock',
)
?>
doing this might mean you need to edit the database.php file when you go live on the production server.
Thanks everyone for pointing me in the right direction. The mysql.sock file has been moved to /tmp/mysql.sock instead of its default location at /var/mysql/mysql.sock. Editing the php.ini file to reflect this has fixed the problem.
check your phpinfo and use the socket listed. that worked for me.
On Ubuntu, if you installed both 7.0 and 5.6 versions of PHP this wont work.
Youll need to switch if you have both versions:
Look first if is 7.0 version: the command is php -v.
Next do
sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart