how to shift osticket from one server to another without reinstalling? - php

I am running osTicket on server and now i need to migrate the server. So i took backup of files and database on my localhost and trying to run it for test but it is giving me error of 500 and descripton is
PHP Fatal error: Can't inherit abstract function AuthenticatedUser::getId() (previously declared abstract in BaseAuthenticatedUser) in /var/www/html/ostickets/upload/include/class.auth.php on line 26
I am testing it on local so that after successful migration i don't want to loose any of my data. please guide.

It is pretty simple, once you've installed the same version of OSTicket in your new server, you just need to migrate the database.
From terminal:
mysql -u root -p ost_db < [PATH TO YOU OSTicket DB BACKUP FILE]/ost_db.sql
Have a great day!

Related

Looking for more info about why I cannot connect with database Codeigniter 4

I made a small tool using Codeigniter 4 on my local machine in windows env with XAMPP.
I created a MySQL database in a server, pulled the code, and applied the appropriate configs but when I try to use parts of the tool that involve databases I get:
CodeIgniter\Database\Exceptions\DatabaseException #8
Unable to connect to the database.
The exception seems to be trow by BaseConnection.php at line 395
392 // We still don't have a connection?
393 if (! $this->connID)
394 {
395 throw new DatabaseException('Unable to connect to the database.');
396 }
I added a .env setting the environment to development so I can see the error messages.
My server is a shared server running PHP 8.0 with the following enabled modules
I also run a small script in the server but outside to Codeigniter to test password, username, port, and address and it is working fine.
Any help and tips to better understand what is happening or how to found out will be very appreciated.
You can check the writable/log folder and will have a more detailed log.

How do I remove table from laravel forge?(were unable to delpoy server)

I removed a table from my local database and pushed the changes onto github, when trying to deploy the changes onto laravel forge i get an error saying we are unable to deploy the server. How do i make the changes on my server. Do i have to ssh into my server or does everything have to be done on my local machine. What do I have to do to remove table and get my server running again?
here the error:
Sun Jan 26 19:25:36 UTC 2020
From github.com:mkesha/project-vo
* branch master -> FETCH_HEAD
2e774fb..651c301 master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
vendor/composer/autoload_classmap.php
vendor/composer/autoload_static.php
Please commit your changes or stash them before you merge.
Aborting
Updating 2e774fb..651c301
You are getting this message because your Forge deploy script is trying to execute a pull request but Git is throwing a warning resulting in your deploy script failing.
You must have changed some of the files on your server for Git to throw this warning. The pull request is failing to avoid overwriting these changes.
I had a similar situation with Forge after compiling my application assets for production on my server. I resolved the issue by adding this line to my deploy script before the pull request and compiling assets later in the script:
## Warning: This will reset local changes!
git reset --hard
git pull origin master
#...rest of the script below...
Before running git reset --hard on your server, please make sure you understand what it does: Your local changes will be lost forever.
This should resolve your deploy error.
Now if you want to remove a table from your application database (on Forge or any server), you should create a migration just to drop the table.
Schema::dropIfExists('users');
See Laravel documentation:
https://laravel.com/docs/5.8/migrations#renaming-and-dropping-tables

MySQL 8.0 + phpMyAdmin + docker [caching_sha2_password error]

As mentioned by others (Ref 1,
Ref 2 and Ref 3) the current phpMyAdmin version (4.8.2) + MySQL 8.0.11 + PHP 7.2.8 doesn't work as expected.
The error happens when you try to open phpMyAdmin, where it shows an error message:
#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
As stated in MySQL migration manual here, and described as the solution in Ref 2, you can correct this by executing the following mysql query inside docker:
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'ROOTPASSWORD';
(In order to run this, I use docker exec -it CONTAINERID bash and execute mysql command)
And it works. The main problem is that I need to fire this query as soon as the container starts (the current method is manual and far from scalable). I assume it's possible in different ways:
By executing a PHP script that runs the query after everything has been setup (IMO this is unsafe )
By running the above command in a bash after everything has been setup
The first one is unsafe IMO as the mysql user must have high privileges, although there will be only the root user when this script runs. I haven't tested it yet.
The seconde one is the best IMO, but I can't figure it out how to implement using Dockerfile, as everything I type there runs BEFORE mysql and phpMyAdmin are installed. How could I achieve that?
My current Dockerfile can be seen here and the docker-compose.yml can be seen here.
As a simple solution, you can build your custom mysql image and run the command there. Then mysql will start with this modification already in place.

Laravel sqlite saying the database is "encrypted or is not a database"

I have a database file on my computer called testing.sqlite, which contains a copy of me database that I want to use for testing (rather than connecting to my ordinary MySQL production server).
I created an entry in the config/database file in laravel as instructed, setting it to access the sqlite file, and it all look right. But when I try and actually do anything, I get the error message:
[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 = vendor_alerts)
I can access the file using sqlite testing.sqlite from the command line, why can't laravel read it?
The problem is that the version of sqlite is different. Laravel uses sqlite3, wheareas the sqlite command on your console might be an earlier version. Run sqlite -version from the command line to check your version - is is probably 2 something. You need to install sqlite3, and you'll find that it is not compatible - i.e. sqlite3 testing.sqlite will produce the same error you are getting from laravel.
So, upgrade your command line sqlite version, and copy the data into a new sqlite3 database, and laravel will work without trouble.

Laravel 4.1 to Heroku: SQLSTATE[HY000] [2002] No such file or directory

I deployed my Laravel 4.1 app in Heroku by following this article http://phpartisan.tumblr.com/post/71580870739/running-laravel-4-on-heroku
The static HTML homepage loaded okay but when I am trying to log-in, I am getting the error
SQLSTATE[HY000] [2002] No such file or directory
My local setup is Laravel 4.1 & MySQL.
I don't think there was a database created when I deployed.
Do I need to do it manually? How and what will be my settings then?
thanks!
The problem could be your environment might still point to local. in cli, type heroku run php artisan env to find out.
else, you might wanto run php artisan migrate --env=production to set it to the correct production environment.
you might then encounter another issue like this:
PHP Fatal error: Call to undefined function Symfony\Component\Console\mb_convert_variables() in /var/www/mysite/vendor/symfony/console/Symfony/Component/Console/Application.php on line 1154
Trust me, tt has nothing to do with mb_string module like what this post stated.
Laravel: Call to undefined function Symfony\Component\Console\mb_convert_variables()?
The problem is at environment setting.
First, make sure you have .env.php file at same dir level with composer.json and it is exists in your heroku instance. Since you cant FTP inside, you need to push to repo. But laravel tell you this is git ignored, so you will need to temporary allow it to push to your heroku repo.
Next, you will need to edit the bootstrap\start.php
replace the $env = $app->detectEnvironment(function(){}) to:
$env = $app->detectEnvironment(function() {
return file_exists(dirname(__FILE__) . '/../.env.php')
?
'production'
:
'local';
});
Once you done all these, rerun the migrate command and it will works.
You may follow this link for reference.
Laravel environment config not loading, migration fails - SQLSTATE[HY000] [2002] No such file or directory

Categories