How to establish database connection with CakePHP on Server2Go? - cakephp

I've been trying to use CakePHP on Server2Go portable server - but for some reason, I'm unable to connect to DB. Moreover, cake flashes some warnings about mod-rewrite.
I have no problems with setting up the same app on XAMPP or WAMPP, also I'm SURE that I'm using the right db details: localhost, root, (no password), and db_name.
Wordpress, drupal, joomla, CI - there are no problems with setting them up to run on Server2Go, but CakePHP is unable to establish DB connection...
What am I doing wrong????

I had to do this:
In the server2go folder there is a file called pms_config. Open it and look for [database]. Below there should be an entry like this
MySQLPort=xxxx
In the Cake db config set host as 127.0.0.1:xxxx where xxxx is the port number from pms_config.
Hope this helps.

You need to enable php_pdo_mysql.dll extension first.
To do that, edit php.ini (into config_tpl dir for Server2Go) and uncomment (remove ; from the start of the line).
Then, restart Server2Go, done!
Be carefull when using old auth method for MySQL users, PDO and/or CakePHP dosent like this anymore!
Then, check the MySQL Port and set CakePHP Database config file to use "localhost:XXXX" where XXX is the MySQL port of Server2Go MySQL Server.
Sucess!

Related

Laravel 'Access denied for root' due to running my app in a virtual box?

I am working through the Laracasts db tutorial to learn how to work with databases in a properly 'Laravel' way. I have set up a local MySql instance and I have run the migrations to set up my tables and fields and also for the built in Laravel user authentication/login/register functions. It all works perfectly on the command line. My user 'root' and password allow me to browse my new db, select and add records as you might expect. However, when I run the app through my browser I get 'Access denied for user root'.
Is this because I'm running my app under 'Homestead/Vagrant'? Do I need to copy my MySQL database to the vagrant box somehow - maybe setting it up with the homestead yaml file? I'm confused!
IF you are hosting your MySQL database on your host but your app inside the vagrant box it won't work. Instead let homestead/vagrant run the MySQL database inside the box and connect into it.

Laravel 4.2 SQL Server - PDOException - could not find driver

I got the error on the title in my project (which is working well in production on remote server). My local server is Apache, WAMP package.
By default, SQL Server is the database conection so I can't even login. I'm going to share many screenshots because I try many solutions what I found while searching on Google but no one fix my issue.
First of all, the exception message which is almost the same for everyone.
[
So now, my System variables with PHP and Postgrade path.
Here is the PHP Extension list enabled/disabled
And the "extension_dir" on PHP.ini
Finally, laravel files setting up the connection...
start.php -> set my "local" environment
and my local/database.php settings
So I got eveything properly setted (I think) and even like this I can't connect.
Any some other help, please?
Finally, the problem was the arquitecture used on WAMP, should be 32bits, not 64 as I got.

Can't select database - Wordpress

When I download a new wordpress from wordpress.org and then paste it into my www folder of WAMP, then create a new database in phpmyadmin, then go to localhost and click the wordpress site, it asks to create the config file, and enter the database details, and i do that correctly, but when I click submit, it says "Can’t select database".
Any Idea why this is?
I already have a local wordpress site that started saying error connecting to database. The config settings are all correct so i tried to download a fresh wordpress site and use it and I cannot even set up a fresh one. I have never encountered a fresh wordpress site not working like this before.
I did a msqldump of my old site so that my boss could put it on his server. Not sure if that is relevant.
Cheers.
Please don't overcomplicate.
In the "Database Host" field add "localhost: e.g. in my case "localhost:3308" solved the problem.
For anyone who's still looking for solutions to this problem - please, check again your wp-config.php database credentials again. I had the same problem today and tried to over-complicate the matter by searching for advanced solutions, while I had a space in my DB_NAME field (was supposed to be 'wpdb' and was ' wpdb').
This space completely messed up my connection, I was even close to reinstalling the whole thing and losing all data.
If using LAMP -
Make sure that all privileges are granted for that database to the created mysql user. Under your MYSQL shell use the below
GRANT ALL PRIVILEGES ON database_name.* TO database_user#localhost IDENTIFIED BY 'user_password';
Where,
database_name = your database name as per wp-config.php
database_user = your user name as per wp-config.php
userpassword = your user password as per wp-config.php
It sounds like either you have not created a database or your wp-config file is not set up correctly. Have you edited wp-config.php file of wordpress and provided correct database name and user credentials. See Famous 5 minute installation of wordpress for details.
It took me way too long to discover that my msql databases were not working on any other websites either. I reinstalled Wamp Server and it worked.
Verify the wp-config.php file.
I had the same error and the problem was related with the quotes:
‘root’ vs 'root'
edit: the correct one is single quote
'
By default
username : root
password : leave it blank
database host : localhost
table_prefix : wp_
For me, the solution was giving wp_user all permissions on the wp_db database.
I achieved this using the command line interpreter (CLI):
$ mysql -uroot -p
MariaDB [(none)]> GRANT ALL ON `wp_db`.* TO `wp_user`#`localhost` IDENTIFIED BY 'pass';
MariaDB [(none)]> exit;
After these operations, I restarted the database:
$ systemctl restart mysql
Of course, the database name (wp_db), username (wp_user), and password of the user (pass) can be different.
my problem was that when I granted permissions to the DB user the host did not match what was in the wp_config.php
/** MySQL hostname */
define('DB_HOST', 'localhost:3306');
I was granting rights with
GRANT ALL ON databaseName.* TO 'UserName'#'127.0.0.1';
This gave me access when I was connected to the local host through ssh but It did not match wp_config.php. so I had to Grant like this then it all worked.
GRANT ALL ON databaseName.* TO 'UserName'#'localhost';
For Mariadb hostname should be localhost:3306 and for MySQL localhost:3308.this fixed my error.
I had this issue when trying to transfer databases between WAMP server installations.
I tried opening PhpMyAdmin on new PC, then got the port of MySql server (:3308) and added this port into DB_HOST ('localhost:3308'). This worked for me.
please create your database with name 'wordpress' before installing wordpress
You may need to create the database yourself.
Visit http://localhost:8888/phpMyAdmin5
create a new database with the name you prefer.
Don't add any table names, just use the name you choose for the database in the WordPress setup

SilverStripe CMS Installation and Development

I am very new to cms and I am wondering if you fine gentleman can help me get started properly. Just a note, I have spent hours researching my questions and I could not find the answer I was looking for.
I have installed silverstripe locally and i started creating my own site with it. Created a new theme, deleted the old 2. It created some random database for me, it was mostly automated. Now I have a server, and I want to put it on my server, but I can't figure out for the life of me how to import it. I was able to install silverstripe and have a default theme (simple) running, but no matter what file I copy or change, it never loads my site. Does anyone has a tutorial on how this is achieved? server is with godaddy.
When I started creating this site, it created a database with a random name, how can I rename that database? What are the files I need to update?
How do I access phpmyadmin locally? localhost:port/phpmyadmin does not works.
1. Site deployment
Here is how I deploy a Silverstripe website to a live server.
ftp into the server
Upload all the files from the development folder to the server
Create a database on the server
Create a database user for the database and add all database privileges
Update the live mysite/_config.php file with your live database username, password and database name
Dump your local database
Import your database dump into your live server database
Call dev/build/?flush=all on your live server
Check the website works
Have a beer
2. Database renaming
The database settings are stored in mysite/_config.php. They should look something like this:
$databaseConfig = array(
'type' => 'MySQLDatabase',
'server' => 'localhost',
'username' => 'database_username',
'password' => 'database_password',
'database' => 'database_name'
);
To rename the database, rename your database in phpmyadmin. Then update your $databaseConfig database name in your mysite/_config.php file.
3. localhost phpmyadmin
Webmatrix does not come with phpmyadmin. You can download it, extract it to your webmatrix html root directory and use it. Or you can download an alternative like adminer, which is a one file database manager.
With regards to renaming your database, see the comments above as they are accurate.
However you still seem to be having problems getting your database out of your local environment, so let's concentrate on that first and see how you go with it.
Note that there are at least two ways you can back up/export your local database:
1). Using phpMyAdmin (Or other web-based DB utility)
2). Using the command line (see the 'mysqldump' command)
You asked about using phpMyAdmin to backup your SilverStripe database so I'll address only 1). above:
As this is specfic to your own development environment and you've not mentioned how far you've got in setting this up locally, nor any error messages you may have received, myself and others can only go so far in helping you out with this.
If you've setup phpMyAdmin as per the installation requirements, it should be installed by default and accessible at this address on your computer:
http://localhost:80/phpmyadmin
The following will also work, as port 80 is the default for most webservers:
http://localhost/phpmyadmin
If neither of these work and you receive a 404, 403 or 500 error (The screen in the browser should tell you which of these has occurred) I'm pretty confident you've not set it up correctly on your system. My suggestion is therefore to go back to the phpMyAdmin docs and re-check you've performed everything correctly as per your own environment setup (e.g. for Linux, OS X, Windows etc).
Once you're setup correctly, have a crack at the DB renaming suggestions above and coe back for more help if you need it.

Key steps to uploading a Drupal website from Local to live using a hosting firm

I'm a newbie to pushing Drupal websites from local to live via a CP panel with a hosting company and wondered if there are any key steps I need to follow? I usually end up with Internal Server 500 errors or no themes showing so not a good start!
The steps I follow are:
Export the database from my local PHPMyAdmin
Log into my hosting CP Panel and create the database on there
Create a user for the database (with password)
Change the settings.php to match the database settings
Load all Drupal files via FTP
Create a 'tmp' folder in the 'sites > default> files' directory
What am I doing wrong?! Is it something to do with the .htaccess file as to why I either get the error or my theme never shows?
Any help would be much appreciated! So stressful and frsutrating as a newbie! Once I've done 1 I'm hoping it'll be plain sailing!!
Thanks!
C
You have the basic steps right. Check the php error logs on the server (probably accessible via the control panel if you dont have ssh access), they should give you more information as to what actually caused the 500 errors.
Doubt it is an htaccess issue unless you are doing something crazy in there.
Can you see he drupal admin at all? If so, clear cache, check watchdog for clues also.
It's easier to download and install Drupal again on the live server rather than to copy everything via FTP. The settings.php file is where your MySQL information is stored so this file should not be copied. Follow Drupal's documentation on how to install Drupal at https://drupal.org/documentation/install/download
To transfer your database, install and enable the Backup and Migrate module on your local server from https://drupal.org/project/backup_migrate and back up your database locally.
After Drupal is installed on the live server, go ahead and copy your modules, themes, and files from /sites/all and /sites/default/files (or any non-Drupal core files that you may have created). Enable and use the Backup and Migrate module to restore your database to your live server. You may need to configure the php.ini file if the database is over 8MB.

Resources