This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is Magento bug. Wrong paths to Windows are generated. The fixed fix is: | |
Magento 2.3.0 | |
#/vendor/magento/framework/View/Element/Template/File/Validator.php:138 | |
the string | |
$realPath = $this->fileDriver->getRealPath($path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://code.tutsplus.com/tutorials/generate-random-alphanumeric-strings-in-php--cms-32132 | |
//$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz'; | |
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz!@#%'; | |
// Output: 54esmdr0qf | |
$password = substr(str_shuffle($permitted_chars), 0, 8); | |
echo $password; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error / Notice / Issue: | |
failed loading cafile stream: `C:\xampp\apache\bin\curl-ca-bundle.crt' | |
Issue | |
[curl] | |
; A default value for the CURLOPT_CAINFO option. This is required to be an | |
; absolute path. | |
;curl.cainfo= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Log; | |
$imageUrl = $linPost->pic_1; // This is a complete URL Path | |
$pos = strrpos($imageUrl, '/'); | |
$imageName = $pos === false ? $imageUrl : substr($imageUrl, $pos + 1); | |
$extension = substr(strrchr($imageUrl,'.'),1); | |
if($extension == 'mp4' || $extension == 'MP4' || $extension == 'mov' || $extension == 'MOV') | |
{ | |
$path_image_save = public_path('assets/imagegallery/video_upload/' . $imageName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arrContextOptions = [ | |
"ssl"=> [ | |
"verify_peer"=>false, | |
"verify_peer_name"=>false, | |
], | |
"http" => [ | |
"method" => "GET", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://arjunphp.com/remove-whitespace-line-breaks-string-php/ | |
Remove Whitespace and line breaks from String using PHP | |
In PHP we have in-build functions to replace white-space from the start and end of the string these are trim, ltrim and rtrim. These functions are incapable of removing line breaks from the target string, a simple search and replace will not get line breaks. | |
trim() function will remove white-space from start and end of the given string. | |
rtrim() function will remove white-space from end of the given string. | |
ltrim() function will remove white-space from the begging of the string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//location in Laravel Project: project_root\app\Exceptions\Handler.php | |
// I have modified the "render" method on line 51 (on line 48 in actual file in Laravel) | |
namespace App\Exceptions; | |
use Exception; | |
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
use Illuminate\Validation\ValidationException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First ONLY run below 2 commands: | |
php bin/magento cache:flush | |
php bin/magento cache:clean | |
Issue should be resolved. | |
If isue persists, try below commands: | |
php bin/magento setup:upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Following error you have given in your post's comment should lead you to the solution after a little search. | |
The problem is Magento's .htaccess file consists <IfVersion> command. | |
In order to use this feature mod_version module should have enabled on your Apache web server. Otherwise it will give 500 error. | |
In Wamp it is disabled by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateRandomString($length = 10) { | |
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
$charactersLength = strlen($characters); | |
$randomString = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$randomString .= $characters[rand(0, $charactersLength - 1)]; | |
} | |
return $randomString; | |
} |