I am trying to implement payment by card in a laravel project. For this i neeed to make a link in Controller to a certificat file.
I put the file in public/files and i made a variable like this
$x509FilePath = '/files/public.cer';
When i'm trying to encrypt an object using this file i get the error
Error while loading X509 public key certificate! Reason:error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
Can anyone help me? Thanks alot!
I think you have to reference the file path using the helper public_path()
Try using:
$x509FilePath = public_path('/files/public.cer');
Related
I have a PHP file located at holiday/app/Console/Commands/myCommand.php with:
namespace Holiday\Console\Commands;
$bob = file_get_contents('Storage/data/BE.json');
and it works.
However in holiday/app/Http/Controllers/holidayController.php I have:
namespace Holiday\Http\Controllers;
$bob = file_get_contents('Storage/data/BE.json');
but I get
file_get_contents(Holiday/Storage/data/BE.json): failed to open stream:
No such file or directory
Does anybody know why this is?
You should always use helpers to get correct path. Here, use storage_path() helper. For instance:
file_get_contents(storage_path('data/BE.json'))
This will create correct path to the laravel_project/storage/data/BE.json file.
I am uploading an image to local storage as
$path = $request->image->store('images');
Image gets stored in storage/app/images/name.extension
However my problem is showing this image to the user, I am getting file not found exception
I tried, asset, Storage:get, Storage::url and etc.
Any solutions?
You can create a symbolic link to the storage/app/images/ from the public directory.
ln -s storage/images public/images
Try this one
Storage::get('/images/'.$filename);
or
Storage::get('/app/images/'.$filename);
Mistake was I was storing files in storage/app/images directory instead of storage/app/public/images and finally I retrieved using
asset('storage/'.$image-name)
I am using Laravel 5.2. I need to get RSS feeds using SimplePie, so I install the library through composer.json and now my vendor folder contains simplepie but when i run the following code this error shows:
ErrorException in SimplePie.php line 1379: ./cache is not writeable.
Make sure you've set the correct relative or absolute path, and that
the location is server-writable.
My code in route:
Route::get('feed', function () {
$feed = new SimplePie();
$feed->set_feed_url(array(
'http://www.thenews.com.pk/rss/2/16' //it has no images
));
$feed->init();
$itemCount=$feed->get_item_quantity();
return $itemCount;
});
Create a writeable cache folder for simplepie in the /storage/ folder (I called mine simplepie_cache).
Set the path in your feed object:
$feed->set_cache_location(storage_path() . '/simplepie_cache');
That should do the trick.
check what is saying ./cache is not writeable can't write to cache folder check permissions to this folder or try a L5 wrapper for SimplePie https://github.com/willvincent/feeds
i have a pdf file in view folder and controller folder by the link i need to access it how to do this i have tried with following by am getting error like
Access forbidden!
$path=base_url()."application/views/users/sample_pdf_report.pdf";
$path2="C:\xampp\htdocs\vacationgod\application\views\users\sample_pdf_report.pdf"
// OPTIONAL - PUT A LINK TO DOWNLOAD THE PDF YOU JUST CREATED
echo ("<a href='$path2'>Download Your PDF</a>");
i have tried both $path and $path2
You probably have a .htaccess file forbidding people to access files in those folders.
You should create a res folder in your site root path and place your pdf file in that folder and link the file from there..
Happy coding :)
In a downloaded module there is a specific call Mage::getModel('module/statistic_collection'), this gives me the failed to open stream: No such file or directory error with the path Namespace/Module/Model/Statistic/Collection.php but it exists in Namespace/Module/Model/Mysql4/Statistic/Collection.php.
So how can I tell magento that they need to add the Mysql4 folder ?
You have two options:
Mage::getResourceModel('module/statistics_collection')
or
Mage::getModel('module/statistics')->getCollection()