The WordPress plugin “Simple Lightbox” is a great plugin that we use from time to time on website to allow for a nice Lightbox effect on image galleries. We ran into an issue today where the lightbox was displaying very far down the page, the fix for this is documented below:
Open up the file:
wp-content->plugins->simple-lightbox->themes->default->sass-> style.css
**Note** this file writes to:
wp-content->plugins->simple-lightbox->themes->default->css-> style.css
So if you don't have gulp watch installed/running then you will want to edit this file directly as this is the file that is used for actual page styling.
With the correct file open you will want to make the following change:
.slb_viewer_layout {
top: 20px !important;
}
Make the needed change in the file to change the host of a website. This is simply writing the IP address of the server, space, the domain name. So in effect it looks like 000.000.00 domain.com
Hit control x to close the file. Press Y plus ENTER to save the changes
Type: sudo killall -HUP mDNSResponder followed by Return to flush the DNS cache.
navigate to the website you want to see
Change Version of PHP in Use With Laravel Valet:
Open terminal and navigate to the project you are working on
Type: Valet use php@7.2 (or whatever version of PHP you want to activate)
Serving Local Websites From Nested Folder with Laravel Valet:
Open iTerminal and navigate to the subfolder where the site lives
run valet link folder-name. This will create a symlink to this site so that you can then open up the web browser and type foler-name.test and the site will serve
Opening files in the finder window:
option + space to open the alfred search finder
~ + file name, so for example ~ repos gets me to code repo folder
once the folder that you want is visible hit command + enter to open it up in the finder winder
Open MySQL from command line & create a new database:
from the terminal window type: mysql (this will login to mysql)
then type: create database db-name; (replace db-name with the real name of the database you want to create and then press return to create the DB)
Once the database has been created open up sequel pro and input the DB name + root and click connect
If you need to import a database from staging or live down to local you can do that by clicking file -> import
Ignore a file in any repo – especially useful it the file has been added to gitignore and it is still tracking changes
git update-index --assume-unchanged -- wp-config.php
or you can run:
git update-index --skip-worktree -- wp-config.php
or for a directory you can run:
git update-index --assume-unchanged -- wp-content/plugins/
git update-index --skip-worktree -- wp-content/plugins/
*If you have a really stubborn file you can use:
git update-index --force-remove wp-config.php
Open up Alias file (or any file) with sublim text from the command line:
Once you follow the steps in that video you can then run the following command to open the alias file in sublime: subl . ~/.aliases
This command can be used to open any file as well just replyce the ~/.aliases with “filename”
***If ever having trouble opening files up with subl . then just open up transmit and the .aliases file will be right there in the local root and just right click and open it up with sublime***
Open up Alias file with Vim
vim ~/.aliases
press shift i to start inserting new lines
when done and ready to save press esc then shift :
Today we had a client’s Joomla website that needed to be upgraded. The site was running a very old version of Joomla v-3.6.4. The client needed it upgraded to at least v.3.6.5. When we started to do this we ran into the error message:
The php temporary folder is not set
To start the update we clicked on the “update now” button in the Joomla admin screen. We went through the normal update process however we were hit with the error message:
the archive file is corrupt, truncated or achieve parts are missing joomla update
From that page we selected our 3.6.5 package, downloaded it and then we went to Global Configuation -> Server -> Path to Temp Folder. In that box we put the full path to the temp folder on the server. We found the full path by logging into the cpanel account and navigating to files manager, and then drilling all the way down to the tmp folder. In our case the path to the temp folder was:
/home/username/public_html/site-folder-name/tmp
*You will want to replace username and site-folder-name above with your sites username and main folder name. That will take care of the error message about the tmp folder not being set.
Once you have your tmp folder set, now go to the normal update screen, click the upload and update tab & then select your the update zip file you downloaded in the earlier step above and your off to the races.
This post is going to go through upgrading a site currently running Laravel 5.6. We will be taking the site up from 5.6 to 5.7 with the goal of eventually going all the way to 6.0 (the latest LTS at the time of this writing).
Start by creating a new upgrade branch from the dev branch:
git checkout -b feature/upgrading-laravel dev
*please note we are pulling from the dev branch here because the dev branch is currently more up to date than the master branch. We are writing these Laravel upgrades during a single day upgrade process, taking a Laravel site from 5.5 all the way up to 6.0. So if you are following along this series updating your own site make sure to branch off of whatever your current branch is (which will most likely be master)
The next thing we are going to do is open up sourcetree and push our newly created feature branch up to the remote repo server. To do this we will hit the push button and then check the box for the new branch and hit push.
Now that we have our new feature branch to the remote repo, were going to login to Laravel shift and purchase the shift we need, in this case we will be purchasing a shift from 5.6 -> 5.7. When we purchase the shift we will input our new feature branch as the branch shift should use to update from. In the Shift Screen there will be 2 boxes and we will need to fill them in this:
username/repo-name branch-name
With our shift purchased and executed, its time to merge the new branch shift creates into our updating branch and check how the site is doing locally:
Before we view the site locally we will also want to run:
composer update
php artisan cache:clear
php artisan route:clear
php artisan view:clear
php artisan config:clear
Issues with cache:clear:
*If the artisan cache:clear line fails due to permissions issue, then do the following to fix that error:
Check to see if the data folder is present at:
storage/framework/cache/data
Create the data directory manually if its not there: (storage/framework/cache/data)
run php artisan route:clear again and it should work :)
--update --
If creating the data folder still does not fix the issue, then try running:
php artisan config:cache
If there are any bugs we will fix those, in this case we did not have any issues so we will go ahead and merge our branch into the dev branch and test it on the staging server.
git checkout dev
git merge --no-ff feature/upgrading-laravel -m "merge laravel 5.7 into dev"
*we can either then git push dev from the command line, or we can use sourcetree to push the dev branch up to the remote server, and deploy to the staging site from there.
Once logged into our staging server we will run our deployment script, and then navigate to the project root folder and run the following commands:
*one special note, if the server has any issue running composer update, we can always delete the vendor directory and then run composer install which will install a fresh version of all dependencies. The fastest way to delete the vendor folder is via command line with:
rm -rf vendor
Fixing Issues:
#1: A Note From Shift: Laravel 5.8 changed several of the core contracts with new implementations and methods. You should review the Upgrade Guide for more detail on these respective changes:
In CustomFormBuilderServiceProvider.php line 9:
Interface 'Illuminate\Contracts\Support\DeferrableProvider' not found
In CustomFormBuilderServiceProvider.php line 9:
Interface 'Illuminate\Contracts\Support\DeferrableProvider' not found
To fix this issue we just updated the packages in composer.json to work with the latest version of Laravel. This was tricky as composer was not able to resolve the packages into an installable set, so what we did is removed all of the packages and then added them back into the file in small chunks and ran composer each time, until we arrived at the full set of needed packages.
Error #2:
The file TrustProxies.php was causing an error message to display in the command line, to fix this we changed the code in this file to:
The latest version of Laravel needs these values to be explicitly defined.
Error #4
Once we try to login to the site we are getting the error:
To fix this we will update our call in AuthAdminiter.php to be:
$this->authenticate($request, $guards);
Error #5
Once we got the login permission issue fixed, we were then presented with this error screen:
If we look at the error we can pull out a few clues:
Missing required parameters for [Route: packages.create_for_vehicle]
[URI: manage/packages/create/vehicle={vehicle_id}].
(View:C:\wamp64\www\SFPS\resources\views\vehicles\partials\table.blade.php)
The route mentioned in the error wants you to pass vehicle_id, but the code as-is is only passing in id so Laravel can’t figure that out. To fix this we can either rename it, or remove the special key. ([$vehicle->id] or [‘vehicle_id’=>$vehicle->id]). So in our case we made the following update to fix the bug:
It looks like Laravel dropped support for SparkPost around 5.8 – so we are now getting these errors on all of our form submissions:
This package was giving us some issues when installing, in order to successfully install it we had to remove the 4.0 version that installed automatically with the package and instead install version 2.0 using the code below::
When we did this we ran into an issue that Guzzle 7.0 was not compatible with V2.0 of the SparkPost Package and could not install correctly as well, so to fix that we ran:
Once that package is installed its important to note that we also need to then run:
php artisan config:clear
php artisan cache:clear
The above gets the site working on our local machine, however when we deploy to the staging site we are still running into a different error screen which we will fix under Error #8 below, but first a general note.
General Error – Error #7
If you are getting the php memory limit error when running composer install or update, which looks like this:
To work around this issue run the code below, which tells PHP to keep trying instead of stopping after reaching the initial memory limit set on the server
composer_memory_limit=-1 composer install
Error #8:
On the staging server we are getting the error that allow_url_fopen must be enabled in php.ini. We login to cpanel and set this to enabled, but we still receive this message. So we will manually run the command below instead, which allows url_fopen for this 1 single command:
which composer
//for us this spits out /opt/cpanel/composer/bin/composer so we will then run
php -d allow_url_fopen=on /opt/cpanel/composer/bin/composer install
Error 9:
With the SparkPost API now working, we are getting the error below:
Client error: `POST https://api.sparkpost.com/api/v1/transmissions` resulted in a `400 Bad Request` response:
{\"errors\":[{\"message\":\"Unconfigured Sending Domain <example.com>
To fix this error we will open up config/mail.php and change the backup email address from hello@example.com to the actual address we want to use:
So we ran into a little bit of an issue today when upgrading Laravel from 5.6 -> 6.0. We updated the version of PHP using the MultiPHP Manager section in Cpanel, however when we then SSH’d into the server to pull in the updated Laravel code and run composer install we ran into the issue of composer using the system version of PHP. The full process we went through is below:
Update the version of PHP on MultiPHP manager page:
composer install
We instead ran:
~/bin/composer install
Composer now uses the version of PHP defined in the shim script, which in our case is PHP 7.3 and we are back to all green happy lines 🙂