I use the forget password package. The settings file is \config\mail.php. Things work fine.
But then I change the setting to .env, the characters are wrong, garbled.
Actually, 4 Chinese characters, 2 are normal, 2 are garbled.
.env
FROM_NAME=通天教主
\config\mail.php
'from' => ['address' => env('FROM_ADDRESS'), 'name' => '通天教主'], //normal
'from' => ['address' => env('FROM_ADDRESS'), 'name' => env('FROM_NAME')], //garbled
'from' => ['address' => env('FROM_ADDRESS'), 'name' => mb_convert_encoding(env('FROM_NAME'), "UTF-8", "Big5")], //garbled
'from' => ['address' => env('FROM_ADDRESS'), 'name' => mb_convert_encoding(env('FROM_NAME'), "UTF-8", "auto")], //garbled
I checked with notepad++, the two files are utf8 without BOM.
Apache server : VirtualHost: addDefaultCharset UTF-8
PHP php.ini : default_charset = "UTF-8"
Then I tried to echo at the bigging of \config\mail.php, detect its encodeing
\config\mail.php
<?php
$str = env('FROM_NAME') . "\r\n";
echo mb_detect_encoding(env('FROM_NAME'));
exit;
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
... ...
... ...
It's utf8, but also garbled.
Is it possible that this is because of Windows + xampp? Any resolution?
Seems like env() is dependent on system active code page. Try getenv() instead.
Related
I get the following error Yajra\Pdo\Oci8\Exceptions\Oci8Exception ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
What I want is to be able to connect to Laravel 5.8.38 to Oracle (remote), and I'm not sure how to do the setup using the service name
Sql Developer Configuration
'connections' => [
'oracle' => [
'driver' => 'oracle',
'host' => '192.168.0.190',
'port' => '1521',
'database' => 'BDDESARR',
'service_name' => '???',
'username' => 'PAT_GUZ',
'password' => 'ujUYjjdk',
'charset' => '',
'prefix' => '',
],
Installation of Yajra following the step by step from https://github.com/yajra/laravel-oci8/tree/5.8
Terminal output
PS C:\wamp64\www\desarrollo\php\laravel\miproyect> composer require yajra/laravel-oci8:"5.8.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Writing lock file
Generating optimized autoload files
File config/database.php
'default' => env('DB_CONNECTION', 'oracle'),
'connections' => [
'oracle' => [
'driver' => 'oracle',
'host' => '192.168.0.190',
'port' => '1521',
'database' => 'BDDESARR',
'service_name' => '???',
'username' => 'PAT_GUZ',
'password' => 'ujUYjjdk',
'charset' => '',
'prefix' => '',
],
Additional information, I made the following code and it runs successfully
<?php
$conn = oci_connect('PAT_GUZ', 'ujUYjjdk', '192.168.0.190/BDDESARR');
if (!$conn) {
$e = oci_error();
var_dump($e);
}
$stid = oci_parse($conn, 'SELECT * FROM MY_TABLE');
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
Laravel 5.8.38
PHP 7.3.12
Oracle: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 -
64bit Production
Windows 10 64 bit
Wamp64
I don't know anything about Laravel, Yajra and other things you mentioned, but this:
'database' => 'BDDESARR',
'service_name' => '???',
looks if not wrong then suspicious. SQL Developer connection suggests that Service name = 'bddesarr'. I don't know what "database" is supposed to be. SID, perhaps, as Oracle complains that SID isn't right.
I am getting this:
> The exit status code '1' says something went wrong:
stderr: "'C:\Program' is not recognized as an internal command
or external, an executable program or a batch file."
I am using wkhtmltopdf to generatepdf under laravel, and it is working fine. I use windows for local project. Now when I try to generate it, I get this error. Nothing change, laravel updated and just my .env file I accidentally deleted.
I create a new one, but either I get a totally blank page for all my project or I get this error when I do ajax request for generating pdf.
I try in .env (by phpdotenv 3):
WKHTMLTOPDF='"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf"'
config/snappy.php:
<?php
return array(
'pdf' => array(
'enabled' => true,
'binary' => env('WKHTMLTOPDF'),
'timeout' => false,
'options' => array(),
'env' => array(),
),
'image' => array(
'enabled' => true,
'binary' => env('WKHTMLTOIMAGE'),
'timeout' => false,
'options' => array(),
'env' => array(),
),
'binary' => env('WKHTMLTOPDF'),
);
Escape your space in your path of wkhtmltopdf bin
Try this:
WKHTMLTOPDF='"C:\\Program\ Files\\wkhtmltopdf\\bin\\wkhtmltopdf"'
Try
WKHTML_PDF_BINARY="\"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\"\""
WKHTML_IMG_BINARY="\"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\"\""
It works for me
Simply do
WKHTMLTOPDF="C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf"
This works for me.
I am using filesystem package without problems for upload and download files to rackspace. According to docs on how to obtain the file url I do:
$content = fopen('logo.png', 'r+');
\Storage::disk('disk_temp')->put('logos/logo.png', $content);
$url = \Storage::disk('disk_temp')->url('logos/logos.png');
Works good. But, this url is http:// version. How to obtain the secure version like https:// if I am using rackspace vendor? Here my config:
'disk_temp' => [
'driver' => 'rackspace',
'username' => env('RS_USER'),
'key' => env('RS_API'),
'container' => 'disk_temp',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => env('RS_REGION', 'DFW'),
'url_type' => 'publicURL',
],
Years before, I used Open Cloud successfully, obtaining the URL as
$file = \OpenCloud::container('cdn')->uploadObject($filename, $content);
$url = (string) $file->getPublicUrl(UrlType::SSL);
Just to know if possible doing the same from laravel itself. Thank you in advance.
For my website I try to send emails from an alias (created alias from google for business). My mail function:
Mail::send('emails.tracktrace', ['text'=>$mailtext,'tracking' => $code,'email' => $email, 'name' => $name],
function ($m) use ($code, $email, $name) {
$m->from('info#mydomain.eu', 'Mydomain');
$m->to($email, $name)->subject('Track your package!');
});
Also in my config/mail.php I have:
'from' => ['address' => 'noreply#mydomain.eu', 'name' => 'mydomain'],
But both are ignored and the MAIL_USERNAME value set in my .env file (with the mail configuration) is used.
I ran into the same problem.. Turned out I tried to use a Gmail account which doesn't let you change the 'from' headers.
(see problem with php mail 'From' header)
I am setting a cookie like so:
$cookie = array(
'name' => 'test',
'value' => 'test',
'expire' => 86500,
'domain' => '.iwantaspeaker.com',
'path' => '/'
//'secure' => TRUE
);
$this->input->set_cookie($cookie);
var_dump($this->input->cookie('test', false));
Which returns bool(false)
I get absolutely no response. I have in the config:
$config['cookie_prefix'] = "iwas_";
And the cookie is stored as iwas_test, so I have also tried $this->input->cookie("iwas_test",true); to no avail.
I can also see that the cookie is set in chrome:
Furthermore, I have also tried using the cookie helper. What must I do to retrieve the cookie correctly? the URL is on a local network machine, so the domain is pointed to the local IP with an entry in my hosts file, if this makes any difference.
ah-ha! make sure you dont pass expire as a string
$cookie = array(
'name' => 'test',
'value' => 'test',
'expire' => 86500, <--
'domain' => 'www.iwantaspeaker.com',
'path' => '/',
'secure' => TRUE <-- will only be set on https
);
// $this->ci->db->insert("UserCookies", array("CookieUserEmail"=>$userEmail, "CookieRandom"=>$randomString));
$this->input->set_cookie($cookie);
var_dump($this->input->cookie('iwas_test', false));