Running Joomla locally from xampp? - joomla

I downloaded a Joomla installation from a server and want to run it locally from xampp. I installed the database and modified the configuration.php to match my local settings.
Now when I call the local URL, it tells me that the connection to localhost was interrupted (ERR_CONNECTION_RESET). It finds the local database because when I change the database name in the config file, it tells me it cant find the database.
Do I have to make changes in the database as well, or maybe at some other place to run it locally?
Thanks!

Check the following things when you are migrating Joomla sites.
It seems DB unable to connect you must check DB name and user details.
Make sure configuration.php is writable.
public $dbtype = 'mysqli'; //which dB type you are using
public $host = 'localhost'; // normally keep as it is
public $user = 'user name'; // DB user name
public $password = 'password'; // DB password
public $db = 'db name';//DB name
public $log_path = '/joomla/logs';//log path your local path
public $tmp_path = '/joomla/tmp'; //temp path if its not correct you can't install plugins.

Related

Valet showing files under wrong Url

Currently running into issues on my server with links to files in my Laravel application.
I currently have a images folder in storage/app/public and I linked the storage/app/public folder to public with php artisan storage:link.
Now i have a image.jpg in the images folder.
On my local system while using valet I can see the image with the tow following links:
/images/image.jpg
/storage/images/image.jpg
On my server only the second one works (which I assume is correct as there is no images folder directly in the public-directory.
Problem is, I often run into issues when deploying as customers can't see images online (as the link is not working). This wouldn't be an issue if I could not see images local while testing the UI.
Anyone also has this issue and can lead me to some kind of solution?
The issue is that the LaravelValetDriver has a fallback test; if the file doesn't exist in the public directory then it will check the public storage directory.
You can find that here:
if ($this->isActualFile($storagePath = $sitePath.'/storage/app/public'.$storageUri)) {
return $storagePath;
}
You can prevent this behaviour by creating your own Valet Driver that extends the LaravelValetDriver and overrides the isStaticFile method, e.g:
class NoStorageFallbackLaravelValetDriver extends LaravelValetDriver
{
public function isStaticFile($sitePath, $siteName, $uri)
{
if (file_exists($staticFilePath = $sitePath. '/public' . $uri)
&& is_file($staticFilePath)) {
return $staticFilePath;
}
return false;
}
}
Using the public disk is straight forward and should work without problems out of the box.
The public disk uses the 'local' driver which by default uses the storage/app directory.
The command:
php artisan storage:link
will create a symbolic link 'storage' inside your public folder that links to the non-public folder storage/app/public.
When the link is working, you can use the following command:
Storage::disk('local')->put('public/file.txt', 'Contents');
This will store file.txt to
storage/app/public/file.txt
You won't be accessing the file at storage/app/public.file.txt instead you will be accessing it using the symlink public/storage...
Therefore your saved file will publicly accessible at
public/storage/file.txt
Use the asset helper you can get the location of the file:
echo asset('file.txt');

Laravel: How to save images to public folder?

I am having trouble uploading a user image to my public folder. The file name generates correctly, and saves the name to my database, except the iamge itself refuses to get saved into my public folder. What am I doing wrong?
public function update_avatar(Request $request) {
if($request->hasFile('avatar')) {
$avatar = $request->file('avatar');
$filename = time() . "." . $avatar->getClientOriginalExtension();
Image::make($avatar)->resize(300,300)->save(public_path('/uploads/'.$filename)); ==> This is causing me errors
user = Auth::user();
$user->avatar = $filename;
$user->save();
}
The public disk is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores these files in storage/app/public. To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public. This convention will keep your publicly accessible files in one directory that can be easily shared across deployments.
To create the symbolic link, you may use the storage:link Artisan command:
php artisan storage:link
https://laravel.com/docs/5.5/filesystem
I think you should try this:
$destinationPath = public_path('uploads');
Image::make($avatar)->resize(300,300)->save($destinationPath.'/'.$filename);
First you must move your image to destination directory and then resize it.
$avatar->move(public_path('/uploads/'.$filename));
Image::make(public_path('/uploads/'.$filename))->resize(300,300)->save(public_path('/uploads/'.$filename));
Note
Check the directory that you moving your file there is already exist.

Laravel subdomain config

Our staging environment on a project uses the same domain AKA staging.mydomain.com. How do I get the Laravel database config to point to a different DB as the config switch is based on the hostname which is the same for staging. and www.?
You can update the detectEnvironment method to use a closure function and run your login in there to determine if your application is local or not.
update bootstrap/start.php like this:
$env = $app->detectEnvironment(function() {
return preg_match('/staging/', $_SERVER['HTTP_HOST']) ? 'staging' : 'production';
});
Now when you are visiting your laravel project from http://staging.xxx URL, it will detect it as staging environment.
Now, you can place the database config specific to staging env in here:
app/config/staging/database.php
This should do the trick.

JFolder::create: Path not in open_basedir paths Joomla error

I am unable to install new components, module, on my live site using Joomla.
I got to know from another post that the problem might be in configuration file which in my case i have:
public $log_path = 'C:\\xampp\\htdocs\\pastrimi/logs';
public $tmp_path = 'C:\\xampp\\htdocs\\pastrimi/tmp';
and I also tried this way with no luck unfortunately:
public $log_path = './logs';
public $tmp_path = './tmp';
and I made the permission to 777 for both folders
how would I make this showing on joomla system information writable these two folders?
You have a set already below path this is called global path.
1) First try with this details.
public $log_path = './logs';
public $tmp_path = './tmp';
If you still got the error then follow the second step
2) Open cpanel and goes to file manager
Left side you will see like below if your directory path in root
/home/Directoryname/public_html/logs
/home/Directoryname/public_html/tmp
If your directory in subdomain then use
/home/Directoryname/public_html/sub domain name/logs
/home/Directoryname/public_html/sub domain name/tmp

how to migrate from xampp to appserv?

I have this codeigniter project that was developed and tested on xampp, when the customer took xampp wouldn't work on his laptop, so he downloaded the appserv and wants to use it instead of the xampp, the home page of the login page of the system is displayed fine but he vannot log in, I changed the database sittings in the database.php file in the codeigniter project, and also removed the comment before rewrite role in the httpd.conf but yet its not working
any help please
set the CI environment to development in your index.php and error_reporting to E_ALL and see what's going wrong. If it's the database, or sessions, browser may have not accepting cookies etc.
Ok, you have probably a base path issue. check $config["base_path"] in application/config/config.php and set it to the directory name relative to web server root.
Like XAMMP has usually
c:\xampp\htdocs\
and the project url might be
c:\xampp\htdocs\projects\project_a
then your base_path would be
$config["base_path"] = "procjects\project_a";
In database.php, please make sure that you have to enter the password as you setup while installing appserv.copy the password that you entered in it
$config['hostname'] = 'localhost';
$config['username'] = 'root';
$config['password'] = 'your_password';
$config['database'] = 'your_database';
$config['dbdriver'] = 'mysqli';
$config['dbprefix'] = '';
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = '';
$config['char_set'] = 'utf8';
$config['dbcollat'] = 'utf8_general_ci';
replace "your_password" with copied password from the above and check it.
otherwise, On the left end of the taskbar, select the Start icon and search for "Reset MySQL Root Password" click on it to open.
In the command window, Please enter the NEW_PASSWORD and Replace it in your database.php

Resources