scandir across domains on one vps - vps

can i use the php scandir command to grab photos from one domian and display them on another?
both are hosted on the same vps.
I have tried this:
$dir = '/home/user/public_html/assetts/media/users/'.$idContainer.'/photos/';
and i have tried this:
$dir = 'https://mymainwebsite.com/assetts/media/users/'.$idContainer.'/photos/';
Both of them return this error:
[function.scandir]: failed to open dir: Operation not permitted in
and this:
Warning: scandir() [function.scandir]: (errno 13): Permission denied in
Im guessing it may be somewhow workable by setting up my users in WHM? or not?
Cheers in advance :)
Jonny

open_basedir restriction?
http://www.php.net/manual/en/ini.core.php#ini.open-basedir
or you have disabled the scandir function.
you also can use The DirectoryIterator class
http://php.net/manual/en/class.directoryiterator.php

Related

how can I solve the image uploading issue in laravel on shared hosting without ssh?

i uploaded my laravel project on a shared hosting platform everything is working fine except the image upload feature probably due to the storage:link command issue.is there any alternative for the same
Depending on the output error, it maybe permission issue and ... , but again you can use manual file upload to a folder in laravel like so :
if($request->hasFile('file_input_name')){
$file = $request->file('image');
$name = md5(time()) . '.' . $file->etClientOriginalExtension();
$file->move(public_path('files'),$name);
}
before anything create a folder named files in public folder and set its permission to 755.
Good Luck.
it seems like a permission issue
your last column in the second picture is for permission separated in 3 type
owner-group-other w for write r for reading x for executing
you have to check your images folder permission to accept write permission

Laravel pdf issue: failed to open stream: No such file or directory by using barryvdh/laravel-dompdf package

I am update composer and use barryvdh/laravel-dompdf package.
the problem is when i click the button it show me error like image below:-
Is that anyway to change the folder path? or am I missing code to modify path to download the pdf file?
You need to run this command:
php artisan vendor:publish
Then, try to create a fonts directory in the storage directory.
i.e. storage/app/fonts. Also, remember to make it writable.
For maximum execution time of 30 seconds exceeded, this is not laravel related issue but it's about php configuration issue. Please see this and fix it: http://php.net/manual/en/info.configuration.php#ini.max-execution-time
You can also see this answer: https://stackoverflow.com/a/30290770/6000629
Hope this will helps you!
Try this:
$pdf = PDF::loadView('pdf/personalpdf', compact('user','result'))->setOptions(['defaultFont' => 'sans-serif']);
It worked for me, I didn't make any file/folder
Just remove the reference to css external file in your cart.placeOrder.blade
Note: This directory must exist and be writable by the webserver process.
under the config file thats what it say: therefore you should create the fonts directory inside the storage.
"font_cache" => storage_path('fonts/'),

Unable to unlink files from CI's asset folder

I am asking this question over here with the hope that it would be solved by somebody.I have a project in Codeigniter v3.1.3.In the assets/admin/uploads/photostory_img directory i have some image files which i am trying to delete using the 'unlink' method.My unlink code in the Controller is like :
unlink("assets/admin/uploads/photostory_img/".$ps_old_img);
However, i'm getting errors like:
A PHP Error was encountered
Severity: Warning
Message: unlink(assets/admin/uploads/photostory_img/): Permission denied
Filename: nautics/Pstory.php
Line Number: 293
Backtrace:
File: C:\wamp64\www\JSNCI\application\controllers\nautics\Pstory.php
Line: 293
Function: unlink
File: C:\wamp64\www\JSNCI\index.php
Line: 315
Function: require_once
I have searched all over the internet and SO also having similar question , but no success yet.Pleas help me.Its driving me crazy.
Seems you don't have anything in your $ps_old_image var so you are trying to delete directory with unlink. Check what's inside your variable.
Second problem may be your path. I use unlink in my projects and I delete files with something like:
unlink("./assets/admin/uploads/photostory_img/".$ps_old_img);
Of course it depends on your certain situation, where do you have your index.php.

Magento 1.9 Installation Error

I am trying to install magento 1.9 on my web hosting server .
I ftp-ed the files into my hosted website but experience the following error when i try to access my URL.
Fatal error: Class 'Mage_Core_Controller_Request_Http' not found in /home/bf/public_html/app/code/core/Mage/Core/Model/App.php on line 1238
I tried a google search but i am unable to find anything relevant .
Just download the Fresh copy from Magento community again. Also make sure that your server has all the prerequisite for Magento as mentioned in below link.
http://docs.magento.com/m1/ce/user_guide/magento/system-requirements.html
Please make sure that below files exist in this directory
app/code/core/Mage/Core/Controller/Request/Http.php
1.Make sure you have enabled curl on your server and with have right file permission.
2.Make sure file should exist on following path:
/home/bf/public_html/app/code/core/Mage/Core/Controller/Request/Http.php
3.Make sure compilation mode is disabled.
/home/bf/public_html/includes/config.php
Every thing inside should be commented.
4.If it does not work, you have to debug this.
Open index.php in root and add these line of code,
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
It will show you why error is coming.Once you will find the root cause, you can get the solution on google or any forum.

Magento 1.7 Admin Login Fatal error: Call to a member function getBlockName() on a non-object in line 43

Can someone help me?
On index.php/admin the following exception was thrown:
Fatal error: Call to a member function getBlockName() on a non-object in /home/ahorraen/public_html/app/code/core/Mage/Captcha/Block/Captcha.php on line 43
Delete var/cache and var/session
This works for me!
Clearing the cache works for me.
Just remove var/cache/All folders
Even after removing it may take few minutes to get refreshed.
Only cache/ and session/ don't work for me.
Set properly chmod write permissions of folders
var
var/cache
var/session
There are a few things that would cause this, such as incorrectly overwriting the admin/captcha/type field in a community or local module. However, this is most likely to be an issue with the cache as others suggested. Make sure that you clear all caches that you have, including Memcached, Redis and/or APC.
See my answer over here for more details: https://stackoverflow.com/a/25902858/1038564
Clearing the cache and session files did not do it for me, but I did find that the website ids were not set correctly for some reason in the core_website table. Once set correctly, all was fine.
Could be because of a module you recently disabled through XML. Was the case here:
/app/etc/modules
Or through the backend.
You can change to your magento directory and do the following in shell:
cd /yourdirectory/
find -type -f -mtime 1
Change 1 to 30 for last 30 days...
Yes. Those are the directories of the Magento installation.

Resources