The site is currently offline due to encountering an error - Mautic - php

After upgrade my server version (Plesk Onyx with debian) I have recreated the domain and database with all the same DB, Users and Password, but mautic show this:
The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator. System administrators, check server logs for errors.
All the necessary php modules are Active and work about pdo, pdo_mysql etc etc.
Additional Information
Mautic version | Last
PHP version | 7.2.19
Browser | Tested with all Browser
Server | Plesk Onyx Version 17.8.11 - Debian 9.9
Steps to reproduce
I have change the server. My previous server version was in CENTOS, now is DEBIAN whit the last version of Plesk Onyx.
I have made Backup of FTP and MySQL, and i have recreate the main domain and the sub domain where MAUTIC are on the root directory sub.mysite.ext.
I have reused same DB Name, DB user and Password, and the DB address is always localhost on port 3306.
I have try to cancel the Cache, but nothing.
I have try to set the right permission by console:
cd /var/www/vhost/thisismywebsite.ext/mautic.thisismywebsite.ext/
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod -R g+w app/cache/
chmod -R g+w app/logs/
chmod -R g+w app/config/
chmod -R g+w media/files/
chmod -R g+w media/images/
chmod -R g+w translations/
but again don't work
On my new server i have a new version of MySQL, 10.1.38-MariaDB-0+deb9u1 Debian 9.8
On my previous version MySql version was 5.5.60-MariaDB
Log errors
[2019-06-21 11:02:29] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\TableNotFoundException: "An exception occurred while executing 'UPDATE users SET online_status = ? WHERE last_active <= ?' with params ["offline", "2019-06-21 08:47:29"]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist" at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 53 {"exception":"[object] (Doctrine\\DBAL\\Exception\\TableNotFoundException(code: 0): An exception occurred while executing 'UPDATE users SET online_status = ? WHERE last_active <= ?' with params [\"offline\", \"2019-06-21 08:47:29\"]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:53, Doctrine\\DBAL\\Driver\\PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)"} []
[2019-06-21 11:02:29] mautic.CRITICAL: Exception thrown when handling an exception (Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'UPDATE users SET online_status = ? WHERE last_active <= ?' with params ["offline", "2019-06-21 08:47:29"]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 53) {"exception":"[object] (Doctrine\\DBAL\\Exception\\TableNotFoundException(code: 0): An exception occurred while executing 'UPDATE users SET online_status = ? WHERE last_active <= ?' with params [\"offline\", \"2019-06-21 08:47:29\"]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:53, Doctrine\\DBAL\\Driver\\PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'admin_mmautic.users' doesn't exist at /var/www/vhosts/thisismysite.ext/mautic.thisismysite.ext/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)"} []
[2019-06-21 11:02:29] mautic.ERROR: Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'UPDATE users SET online_status = ? WHERE last_active [] []
Heeelp
Please i'm going crazy. Some one can help me?

Some times this is due to server permission issue, Mautic need write permission for the instance's server file so,
Give the write permission
Clear the cache php app/console cache:clear
Give again permission
Refresh the dashboard page
It will work fine.
OR
If the issue is not solved with the above process then you have to update the Mautic version to over come this issue.
To Update Mautic instance, please follow the below steps
First get the backup of the code (zip -r filename.zip project folder path).
Get the database backup (mysqldump -h host -u username -p(password) database name > projectname.sql)
Give the file permission and clear the cache. By using (php app/console cache:clear or rm -rf app/cache).
Check if there is any update available. By using (php app/console mautic:update:find).
If there is any update available then update the instance.
By using (php app/console mautic:update:apply).
Now give the file permission and remove the cache again.
Now done the instance is updated and test it. That’s it.
If still you issue is not solve then you can update the mysql database schema.
To do this please follow the link https://www.mautic.org/docs/en/tips/troubleshooting.html

I would just double check that your new system is using the same prefix for your database tables, and that they have all been moved over using the same database name.
Specifically, look in your Mautic configuration (app/config/local.php) and check the database connection details (db_host, db_name, db_port, db_user, db_password) prefix (db_table_prefix), etc and ensure they match what you're seeing in your database.
In your error logs above, it seems that you are trying to find the table:
admin_mmautic.users
The errors are telling you that this table doesn't exist.
Maybe a typo (admin_mmautic seems like an unusual prefix to me) or that before the prefix was different on your old server and did not include admin at the start?

Related

Got an error while Laravel Project Transfer in another folder

I copy my Laravel project from one folder to another folder. I tried to run php artisan migrate, but I got an error. No any command can be executed successfully in the new root folder. I tried to run composer update & composer install but it also does not work.
The error is:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_name.table_name' doesn't exist (SQL: select column from table_name )
I changed the database name from .env. The problem is solved if the database is imported from the old database.

SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: YES) (SQL: select * from `cats`)

I am building a basic CRUD app using Laravel 7 Homestead in a Vagrant VM. The root address http://crud-app.local.test works, but when I add a defined route (http://crud-app.local.test/cats) I get this error page:
Error message in browser when navigating to '/cats' route.
So far I have:
Verified my MySQL password matches in the .env file and in practice
Changed the MYSQL password so that it's no longer empty (and made sure it matches what's in the .env file)
Ran php artisan config:cache
Ran php artisan config:clear followed by php artisan cache:clear
Changed 127.0.0.1 to localhost
Made sure the database defined in the .env file exists (crud)
Ran php artisan migrate (no errors, and the cats table exists in the crud database)
Restarted and re-provisioned the machine (vagrant reload --provision)
I'm at a loss now.
Make sure that you give "root" permissions to read from the database that you've created. As it's root#localhost rather than root#127.0.0.1 sometimes mysql differentiates. Just check the permissions that root#localhost has for the database and if you update them, flush the privileges.

Why can't I view this laravel project?

I am admittedly new to Laravel and back end development but I'm trying to open a Laravel project in my browser and am receiving an error message instead. I'm inheriting this project from a client who was working with another group of developers and they have since gone AWOL so I'm on my own to try to figure out what the issue is here.
The first error messages were:
**Warning:** require(C:\xampp\htdocs\vizzue\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in **C:\xampp\htdocs\vizzue\bootstrap\autoload.php** on line **17**
**Fatal error:** require():Failed opening required 'C:\xampp\htdocs\vizzue\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in **C:\xampp\htdocs\vizzue\bootstrap\autoload.php** on line **17**
To try to fix that error (from a solution I found on here), I ran composer install in the terminal to try to download the missing files. That switched the previous error messages to Whoops, looks like something went wrong. (Not very helpful).
So then I found more advice on here to get more detailed errors for my problem and was outputted a long list of errors under four separate headings.
Heading 1
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from `sessions` where `id` = hA02gV6ShpNslkw0N8Wrgm8QmyA0ZxoXfCNHsVTK limit 1)
Heading 2
PDOException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)
Heading 3
QueryException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from `sessions` where `id` = hA02gV6ShpNslkw0N8Wrgm8QmyA0ZxoXfCNHsVTK limit 1)
Heading 4
PDOException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)
My PHP version is: PHP 7.2.28
My Laravel version is: Laravel Framework 5.4.36
Also, I have created a .env by copying the .env-example file.
EDIT:
I found the database information inside of the database/migrations directory so I actually DO have the database files. I'm still having an error, however. I ran php artisan generate:key and that was fine. But when I ran php artisan migrate I got the following error:
In Connection.php line 647:
could not find driver (SQL: select * from information_schema.tables where ta
ble_schema = homestead and table_name = migrations)
In Connector.php line 68:
could not find driver
first you have change the name of .env.example to .env then configure your database names settings in it. after that run composer install to install your project dependencies. make sure your webserver is up and running
You should configure your .env file to enable laravel access on your database. If you don't have one just copy the .env.example file and rename it to .env.
And then change the following properties:
DB_DATABASE=YOUR_DATABASE_NAME
DB_USERNAME=USER_NAME
DB_PASSWORD=PASSWORD
and then you should run php artisan key:generate to generate a new encryption key
EDIT
For your new problem you should run composer update and then composer require doctrine/dbal
if that does not work
You might need to comment out the following in your php.ini file.
;extension=pdo_mysql.so
As said here
Here is the basic installation process for a laravel project. I'll try to explain each of them so that you'll be able to figure out your mistakes on your own.
Getting the source code
You first need to get the source code of your app . Most of the time it's done via git . For instance , you'll need to type git clone https://github.com/miracuthbert/saas-boilerplate.git yoursaasproject to clone the repository hosted on github here
Install dependencies
Go to the root of the directory of the source code you previously got by typing
cd projectname.
The laravel framework uses composer as its dependencies manager. So you need to install it . (What you already did)
Then, from the root of your project, type the following intructions in the same order :
composer install
composer update
Environment configuration
The environment variables of the laravel framework are managed through a dot env file. An example file named .env.example is generally provided. You'll find it at the root of your project's folder. Assuming you are using a terminal with a bash prompt, type the following command to copy the .env.example to a .env file :
cp .env.example .env
After getting your new .env file, type
php artisan key:generate
to generate secure key in your .env file
Depending on the type of database management system you intend to use, here are some specific configurations to add in your .env file :
MySQL
If you choose MySQL as your DBMS, set the following values in your .env file :
DB_CONNECTION
DB_DATABASE
DB_USERNAME
DB_PASSWORD
homestead is the default DB_USERNAME and localhost is the default database host. Localhost is totally fine for working locally but you need to change your DB_USERNAME to an actual user of your DBMS with the corresponding password.
Sqlite
If you use sqlite, create a new sqlite database by typing :
`touch database/database.sqlite`
After setting up your database, enter the following command to create and populate tables :
php artisan migrate --seed
You may also need to edit other variables in the .env. The official laravel documentation is your best companion for that.
This is to the best of my knowledge what you need to do.
As for the driver error, here are few potential solutions adapted from an answer to a similar problem question asked here :
Be sure to configure the 'default' key in app/config/database.php
For mysql, this would be 'default' => 'mysql',
If you are receiving a [PDOException] could not find driver error, check to see if you have the correct PHP extensions installed. You need pdo_mysql.so and mysql.so installed and enabled. Instructions on how to do this vary between operating systems.
For Windows, the mysql extensions should come pre-downloaded with the official PHP distribution. Just edit your php.ini and uncomment the lines extension=pdo_mysql.so and extension=mysql.so
Also, in php.ini, make sure extension_dir is set to the proper directory. It should be a folder called extensions or ext or similar inside your PHP install directory.
There are other instructions given in the original answer but I'm only recommending those I understand. It was initially written for a postgres dbms.
If there are still problems, take a look at laragon. It's a bit like xamp (that you appear to be using on windows OS), but more powerful and easier to use.
The main backend languages and frameworks can be set up easily in few minutes. That includes php with laravel/symfony, ruby and Ruby on Rails, python and Django.
It allows you to manage multiple versions of the same programming language without any hassle and is fully extendable.
If you're new to Laravel or backend development, and working on the windows operating system, this is a must have.

Laravel php artisan migrate not working

When I try to use 'php artisan migrate' in Laravel I get 2 errors:
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database (SQL: select * from sqlite_master where type = 'table' and name = migrations)
[PDOException] SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database
I created a storage/database.sqlite file before attempting the migration. I also edited the config/database.php, making the default=sqlite. I am using windows and have sqlite3 installed.
Has anyone encountered this/know how to get past it?
I had the same results, in my case the /database/database.sqlite file was not empty.
I deleted the contents reran
php artisan migrate and the migration table was created successfully.
Running Laravel in Windows under the Powershell console I was getting the same errors as the original poster. The documentation reads After creating a new SQLite database using a command such as touch database/database.sqlite... The Powershell equivalent of touch is typically Out-File FILENAME
PS D:\Learning\PHP-Laravel\database> out-file database.sqlite
PS D:\Learning\PHP-Laravel> php artisan migrate
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 26 file is not a database...
When creating my database.sqlite file I received these errors. I deleted the database and recreated it using the New-Item command and it worked properly
new-item -ItemType File -Name database.sqlite
PS D:\Learning\PHP-Laravel> php artisan migrate
Migration table created successfully.
Check the file you made as .sqlite and make sure it is empty if not then make it empty
database/db.sqlite
then run migration
If somebody came here with the same error with manually created table in sqlite db - it could be the sqlite version mismatch. I solved the same error by emptying db file and recreate the table with getConnection()->statement('CREATE TABLE
check if your .sqlite file is empty and the is no indentation(no spaces)

Laravel migrate unknown database

I am having some errors with laravels php artisan migrate command, when I try to migrate, it keeps throwing errors saying, unknown database 'database name'
I have checked my database configure file and even copied to a different project and it works perfectly there, I have tried composer dump-autoload command but that didn't solve the problem either. Please I will really appreciate if someone helps, since this is a new project and can't afford to lose even a minute to my deadline, thanks in advance!
The command I run from the terminal while I have CD'ed into the project folder is.
php artisan migrate
This is the error I get.
[PDOException]
SQLSTATE[42000] [1049] Unknown database '[gicfamily4]'
[PDOException]
SQLSTATE[42000] [1049] Unknown database '[gicfamily4]'
This is a MySQL error and is indicative of either a misconfiguration in your environment's database.php config file (misspelling in the database name) or the database gicfamily4 simply doesn't exist on the database server you are connecting to.
Verify your connection information again. If possible, try to attempt to connect to the mysql server from the command line using the exact same information contained in your database.php file (via copy and paste):
$ mysql -u <username from database.php file> -p -h <database host from database.phpfile>
Enter Password: <paste password from database.php file>
mysql> use gicfamily4;
I suspect you will get the exact same error as above.

Categories