Joomla 3 test site vs. production site: which files should change? - joomla

I am maintaining a Joomla 3 site, and I want to set up a test site in a different web host, so that we can test code changes in it first. The test web host is in a different server, uses a different DB, etc., but otherwise I want it to be as identical as possible to the production site.
Which files should I pay attention to, when downloading and uploading the site to the other host? I know about configuration.php. Is there anything else?
(All the docs I've found when searching were about older versions of Joomla: 1.5, 2.x...)

Here is another solution which does not involve any third party component. You need to take care of some points though. Steps are explained below.
Copy the entire files from 1st server to 2nd server.
From phpmyadmin copy the database from 1st to 2nd server.
Change the database details and other configuration details in the configuration.php file. Mainly you need to change the database details and the log and tmp path. Check the log and tmp folders are writable.
<?php
class JConfig {
public $db = 'joomla';
public $dbprefix = 's5oiy_';
public $log_path = 'C:/xampp/htdocs/joomla/administrator/logs';
public $memcache_server_host = 'localhost';
public $memcache_server_port = '11211';
public $password = 'dbpass';
public $sendmail = '/usr/sbin/sendmail';
public $smtpauth = '0';
public $smtphost = 'localhost';
public $smtppass = '';
public $smtpport = '25';
public $smtpsecure = 'none';
public $smtpuser = '';
public $tmp_path = 'C:/xampp/htdocs/joomla/tmp';
public $user = 'root';
public $memcached_server_host = 'localhost';
public $memcached_server_port = '11211';
public $redis_server_host = 'localhost';
public $redis_server_port = '6379';
public $redis_server_auth = '';
public $redis_server_db = '0';
public $proxy_enable = '0';
public $proxy_host = '';
public $proxy_port = '';
public $proxy_user = '';
public $proxy_pass = '';
public $session_memcache_server_host = 'localhost';
public $session_memcache_server_port = '11211';
public $session_memcached_server_host = 'localhost';
public $session_memcached_server_port = '11211';
}
?>
These are the variables in configuration.php file that need to be checked once you change the server.
If you dont know the Base directory path you may give wrong log and tmp path. So to know the directory path you can use this code
<?php
$dir = getcwd();
echo $dir;
?>

For things like this I suggest using Akeeba Backup and Kickstart
https://www.akeebabackup.com/products/akeeba-backup.html
https://www.akeebabackup.com/products/akeeba-kickstart.html
Just create a backup of your site and use Kickstart to install it on your test server. The install process will take care of the different settings. Make sure you disable sending mails from the test system. Otherwise your users might get mails the should not get.

Sven's suggestion is great, here are a couple of other options.
There might be some advantages to creating your test site on the same server as your production site, for one thing, you'll know that the server environment will be the same. Here are 2 ways you could do this.
You could create a new 'test' subdirectory on your production site and use Akeeba backup to install a copy of your site in that location. If you do this, take care to create a second test database and specify this new database when you use Akeeba backup. When you are finished your production site will be at www.domain.com and your test site will be at www.domain.com/test/
Alternatively StageIt is a very good commercial plugin which will setup a staging environment on your production server. You can test your ideas and sync them back from the test to the production site when you are finished.
Good luck!

Related

NULL folder inside public folder on CI 4 project

What is NULL folder inside public folder in my CI 4 project? seems like session cookies. How to set folder name so not appear as NULL, Thank you
Here you opted for the Driver FileHandler of Codeigniter 4 which stores session in files. In order to work properly you also need to give him a session save path.
Session configs are driven in the .env file and/or in app/Config/App.php.
Example of the config in App.php file with a session save path :
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
public $sessionCookieName = 'ci_session';
public $sessionExpiration = 28000; // 8h
public $sessionSavePath = 'hello/world';
public $sessionMatchIP = false;
public $sessionTimeToUpdate = 300;
public $sessionRegenerateDestroy = true;
Watch out :
It currently looks like that setting config in both files for the FileHandler driver is a bad idea. Setting it in App.php file seems a better option since it allows you to use multiple directories like dir1/dir2/my_session where this syntax catch an error in the .env file. But still be aware that the .env config ALWAYS takes over the one set in App.php

localhost/joomla = Showing only Error not Work

I am facing the issue of localhost/joomla is not showing login page, just show word Error
I have attached permission details and other corresponding files. Please help me to solve this issue.
Thankyou for your time.
Seems like the database the site it's not connected.
Check your configuration.php (in the root of the site) for this parameters:
public $dbtype = 'mysqli'; // Driver you are using to connect to the MySQL database.
public $host = 'localhost'; // The host for the database. If it's in the same server, it's ok like this.
public $user = 'root'; // Username for the database
public $password = 'root'; // Password of the database
public $db = 'NAME_OF_THE_DATABASE'; // Name of the database.

How to enter localhost url manually ( using xampp php version 7.2)

I am trying to get into my root i have xampp in my D folder and i have create folder name (app) into my htdocs and created file Book.php now i am trying to access this file using url http://localhost/app/Book.php but no output. can anyone correct me?
class Book // class is where we define properties and methods
{
public $isbn;
public $title;
public $author;
public $available;
//instantiate
$harry_potter = new Book();
$harry_potter->isbn = 322401494;
$harry_potter->title = "Harry Potter and Magicians";
$harry_potter->author = "Shahzad";
$harry_potter->available = 10;
var_dump($harry_potter);
Actually, I can see 2 main reasons for this to happen,
You aren't using the right port, XAMPP might be using another port like 8080 check it out in the settings. If this is right then you should access to your file using localhost:port/book.php
Book.php return nothing, you should post book.php code here so we can figure out where is the problem.
Hope it could help.

How to read images from a remote sftp file server

So I'm using CodeIgniter PHP Framework for a website. We have a few servers, a live, a dev, and a file server. We've successfully been able to upload files to our dev server, and then secure copy them to our file server for storage. Our problem now is a way to read/display the images on our dev website from the file server. Our file server uses sftp for it's security. We've been looking into different ways to just pass back an image object from the file server, but not actually the actual file. Any suggestions on how to do this? Thanks.
CodeIgniter PHP Framework
Linux Servers
SFTP on the file server
Thanks...
Well, I have not dealed with sftp so much but at lest I will try to give you some steps to begin.
You need install some apache/php module like ssh2 and enable it with extension=php_ssh2.dll.
You could make your own sftp library, like this:
class Sftp{
protected $connection;
public function __construct($params)
{
}
public function connect()
{
$server = "you-server.com";
$port = "1234";
$username = "admin";
$password = "blabla";
//connect
$ssh2 = ssh2_connect($server, $port);
if(ssh2_auth_password($ssh2, $username, $password))
{
//sftp session
$this->connection = ssh2_sftp($resConnection);
}
else
{
echo "Unable to connect to server";
}
}
public function download($image_name)
{
$image = fopen("ssh2.sftp://{$this->connection}/path/to/{$image_name}", 'r');
fclose($image);
}
}
And then try to use it like:
$this->sftp->connect();
$image = $this->sftp->download('image-name');
I found this Codeigniter library on Github. I haven't used it yet but it seems like you need to do several steps before you could use load the library using Codeigniter. Otherwise this looks promising.
https://github.com/ipolar/CodeIgniter-sFTP-Library

Different way of referencing images/stylesheets based on development and production environment in Zend Framework?

I want to host images on separate sub-domain to avoid sending cookies with HTTP request.
There are two domains:
mydomain.com - to serve all the content
static.mydomain.com - to serve images and static content
Both domains are pointing to the same directory hierarchy.
So is there any way to utilize Zend framework feature to:
In development environment reference to static content locally
In production environment use full domain name (static.mydomain.com)
Simplest solution would probably be to create a view helper, something along the lines of:
class My_View_Helper_AssetPath extends Zend_View_Helper_Abstract
{
public function assetPath($filename)
{
if (APPLICATION_ENV == 'production') {
$path = 'http://static.mydomain.com';
} else {
$path = '';
}
$path .= $filename;
return $path;
}
then in your templates:
<img src="<?=$this->assetPath('/images/logo.png')?>" ... />

Resources