I'm about to gain some experience on Yii so I set up a XAMPP (1.8.1) for Linux environment and installed the Yii framework.I progress based on the book titled 'Web Application Development with Yii and PHP' and there's an example to set up database connection and test that through the Yii console by running the following code:
echo Yii::app()->db->connectionString;
Of course previously I created the appropriate MySQL database and set up the connection string in corresponding main.php and console.php but I'm getting an error:
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in /work/webroot/yii/framework/db/CDbConnection.php:382
Based on Yii's requirement checker PDO for MySQL is enabled. If I check the HTML version of phpinfo it says:
PDO Driver for MySQL: Enabled
and
Client API version: mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $
However if I run phpinfo from a Yii console it gives the following result:
PDO support => enabled
PDO drivers =>
So, for me it seems PDO driver is missing. I read several forum threads about how to download PDO drivers for linux and how to change the php.ini to use those drivers but I guess that solution works for CLI environment and not for XAMPP.
Can somebody help me out here how can I set up PDO driver for MySQL database on XAMPP? I'm using Ubuntu 13.10 desktop.
I was playing around for a while and found the solution with the help of several forum threads.
To resolve the following driver issue...
'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver'
... I had to install the correct connector. I ran the following:
sudo apt-get install php5-mysql
After that I tried to check the connection string once again via the Yii console by running code:
echo Yii::app()->db->connectionString;
But this time it gave me a different error mesage:
'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
To resolve this issue I changed my main.php and console.php under /protected/config directory and replaced 'localhost' to '127.0.0.1'.
Based on the PHP documentation this is required because MySQL Unix socket shouldn't be used with host or port.
This resolved the second error message and I could connect to my database.
Related
I am trying to install ERPNext on RHEL 8. I have no experience with ERPNext installation and RHEL 8 so this is a learning process for me.
Below is where I'm having trouble with the installation. Since this is just for me to learn how to install before I implement it on the production/development server, I decide to use "localhost" as I do not own any domain.
[erp#localhost frappe-bench]$ bench new-site localhost
MySQL root password:
For key character_set_server. Expected value utf8mb4, found value latin1
For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci
================================================================================
Creation of your site - localhost failed because MariaDB is not properly
configured. If using version 10.2.x or earlier, make sure you use the
the Barracuda storage engine.
Please verify the settings above in MariaDB's my.cnf. Restart MariaDB. And
then run `bench new-site localhost` again.
================================================================================
Database settings do not match expected values; stopping database setup.
The guide that I'm following is here
I am a beginner with server deployment, RHEL and related topics.
####################### -UPDATED- #######################
I managed to complete the installation. All I need to do was adding a few lines to the my.cnf file. Then, everything work just fine!
I'm a new developer-in-training attempting to set up my Ruby development environment on a Windows machine using Ubuntu. I'm following the instructions here:
https://gorails.com/setup/windows/10
I've made it to the last few steps of the process, which is where I'm started to get errors:
# Navigate to the C: drive on Windows. Do this every time you open the Linux console.
cd /mnt/c
# Create a code directory at C:\code for your Rails apps to live (You only need to do this once)
mkdir -p code
#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql
#### or if you want to use SQLite (not recommended)
# rails new myapp
#### Or if you want to use MySQL
# rails new myapp -d mysql
# Then, move into the application directory
cd myapp
# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified
# Create the database
rake db:create
rails server
On the step to set up Postgres:
rails new myapp -d postgresql
I receive this error about setting up nodejs:
/home/event/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/event/.rbenv/versions/2.6.5 in PATH, mode 040777
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Even after I go to the URL provided and install NodeJS, that error still shows up when I attempt to repeat the process. Is this just a matter of it not existing in the correct path and I need to relocate it?
Also, I've attempted to proceed with the other steps despite that error. When I enter this command, the second last one in the article referenced above:
rake db:create
I receive this error:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'myapp_development' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Tasks: TOP => db:create
(See full trace by running task with --trace)
I've searched around about this with little success, and attempted to decipher what the error messages mean; but at my current level of knowledge it just seems beyond me. Appreciate any insight anyone has to share on this!
I installed mongo following this tutorial with the exception that I ran the service with pm2 because I can actually tell what I am doing with pm2.
I then have been trying to follow this tutorial however I cant even access the shell.
I have tried the following commands and none of them work:
./bin/mongo causes a file not found error whether it is in my project file or in the /var/lib/mongodb folder where the db is supposedly "installed"
Additionally
mongo localhost:27017 (or just mongo)
causes
MongoDB shell version: 3.2.19
connecting to: test
2018-02-12T20:15:59.009+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2018-02-12T20:15:59.009+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
My log file (from /var/log/mongodb/mongod.log) can be found here. I do have some confusion about it:
Why did it shut down
Why is the host=GraphicsApplications? That is an old folder that I have since deleted on my machine. It was my first attempt at getting this going but back then I was hosting my DB with mlab. The folder/name it lists no longer exists. For some reason though the start of every line in terminal says root#GraphicsApplications. Not sure where that name came from... perhaps I named the box that?
Ultimately I dont know exactly how that tutorial had me install mongodb. Sure I installed the packages and everything but I dont feel like I ever really created anything if that makes sense.
It is worth noting that pm2 does show the status of the mongod app as "errored" currently but I am not sure why or for how long it stayed up.
I am just trying to get my database running on my own Linux box rather than mlab. I had everything working with mlab but now want to be hosting my db on localhost.
Looking in the logs it says that your hostname is host=GraphicsApplications
But in your actual hosts file you have 127.0.1.1 GraphicsApplications GraphicsApplications
Edit this line in your hosts file to be just 127.0.1.1 GraphicsApplications
Then save the file and rerun mongod. Hopefully that should do it.
Regarding file not found:
Try running from the cmd line:
which mongo
If that doesn’t show any result then the mongo binariesarn’t in your PATH env variable, in which case try
find / -name “mongo*”
That should then show where your mongo binaries have been installed.
If you know where the binaries are installed then running:
./bin/mongo
Presumes you’re in the mongo home dir, so you would need to run;
/var/lib/mongodb/bin/mongo
Regarding connection refused
could be an iptables rule, try disabling it and starting mongo
sudo ufw disable
hostfile
Comment out this
127.0.1.1 GraphicsApplications
And change/add this
127.0.0.1 localhost localhost.localdomain
As per : https://jira.mongodb.org/plugins/servlet/mobile#issue/SERVER-20952
I'm trying to connect to mongolab via shell. I get a code from lab.
mongo ds023432.mlab.com:23432/somecol -u fakeusername -p fakepass123
Of course i created a db user on mongolab site. However When i call the above command I get the following error:
MongoDB shell version: 3.2.6 Enter password:
connecting to: ds023432.mlab.com:23432/somecol
2016-05-16T17:55:04.290+0200 E - [main] file [fakepass123] doesn't exist
failed to load: fakepass123
So far I am able to connect only via driver. And I am using Arch linux
What am I missing?
I am using Arch Linux as well with mongo client version 3.2.6 and have the same issue.
I would assume it is a client - server incompatibility (since my java application can connect with its driver)
To solve the issue I've installed robomongo via
yaourt -S robomongo-bin --noconfirm
Notes:
Follow these steps to get yaourt if you don't already have it
I am not affiliated with robomongo - it's just a solution for the problem I was facing
I have a oracle 11g XE instance running under ubuntu server. I tried changing the hostname of the server by modifying the host name in /etc/hostname, /etc/hosts, tnsnames.ora and listener.ora but the oracle-xe instance fails to start after reboot. Any idea which configuration I am missing?
Sometimes Oracle starts with only certain services / functionalities not working properly... If that's the case and your Oracle instance partially failed to start you can get some more information about running listeners by invoking the lsnrctl command line utility and then using the status command.
You can also look for clues in the Oracle log files under <oracle-install>/app/oracle/diag/tnslsnr/<hostname>/listener/alert/log.xml - you should definitely have one for your old hostname and you might have another one created for your new hostname as well.
I had this and solved it just rename your listner.ora and restart, it will change the setting for the new host name
see my explanation Here