I have been doing research on how to get a file out of directory using php/Laravel and nothing seems to be working.
I am running a command: app/commands/commandfile.php and I am trying to get a PNG file out of my directory: app/storage/resources/icon.png. Well I have tried several methods:
Storage::url('storage/resources/icon.png') and asset('storage/resources/')
But nothing seems to work. Can someone help me out?
If you are curious why I need this file. I am calling a notification system: php-fcm and trying to set the notification icon:
$note = new Notification('Catalyst', $message);
$note->setColor('#ffffff')
->setBadge(1)
->setIcon(
Thanks!
Related
im trying to parse pdf to text via PHP and XPDF (pdftotext.exe). On my localhost everythings works well, but when im trying to move everything on server, im getting into troubles.
First of all i checked some settings on server and safe_mode is off, exec is not disabled and permissions are rwxrwxrwx.
Then im trying this
$command = "\\\\149.223.22.11\\cae\\04_Knowledge-base\\tools\\pdftotext.exe -enc UTF-8 ". $fileName . " \\\\149.223.22.11\\cae\\04_Knowledge-base\\output.txt";
$result = exec($command,$output,$args);
echo shell_exec($command);
which isnt working. When i look into $result, $output, are empty, but $args returns 1 which coresponds to Incorrect function by this document windows system error codes
Whole command looks like \\149.223.22.11\cae\04_Knowledge-base\tools\pdftotext.exe -enc UTF-8 \\149.223.22.11\cae\04_Knowledge-base\testpdf\04_egerland_final_paper.pdf \\149.223.22.11\cae\04_Knowledge-base\output.txt and when is dirrectly inputed into commandline, its working.
So im a bit out of ideas. Have someone any hint?
edit 20160201 - aditional trying
So i made aditional tests and when im trying to run similar command with exec from localhost (target .exe file, input and output file is in same location, only im using localhost not server) its working. Im now checking differences in server settings. So can here be problem, that localhosts Server Api is Apache 2.0 Handler and server is CGI/FASTCGI?
So it was all mistake on my side. I badly checked IIS permissions and forgot to assign user to virtual directory which i wana to access. So my only advice and more wisdom from this is to double (maybe triple) check if you have all permissions set correctly.
I have a file upload form where an image is being uploaded first to my server and then to Imgur. The upload to Imgur is supposed to be queued. So, once a new file is uploaded, I do a push:
Queue::push('JobController#someJob',['v1'=>'something','v2'=>'something']);
I used this to subscribe to the queue:
php artisan queue:subscribe name http://url
Now, I can see that this is working because I can see the subscription in IronMQ
However, when I do an upload, the image uploads fine in my server and shows no error. But there are no message sent to IronMQ:
Thus, those Imgur uploads are not happening either. I have tested everything and searched extensively, I haven't found any solutions to this yet. Any idea whats happening?
Found the issue:
I was stupidly calling Queue::push (...) after I had already done return Response::json('done',200).
Since the function ends in return the queue was not being called.
I am trying to create symlink in php with following code:
$link = (session_save_path() ? session_save_path() : sys_get_temp_dir()) . "/sess_" . $this->generateSessionId($_REQUEST['broker'], $_REQUEST['token']);
if (!file_exists($link)) $attached = symlink('sess_' . session_id(), $link);
if (!$attached) trigger_error("Failed to attach; Symlink wasn't created.".$link, E_USER_ERROR);
I am using domain name instead of localhost. I tried to run this code on
Windows 7 with Apache, and Windows 8 with IIS / IIS Express / Apache
Everytime I get same error in logs as follows:
symlink(): Could not fetch file information(error 2)
It would be great if someone can help me out in this, I already spent whole night on this thing.
Finally I found the problem.
I don't know how this code has worked for me before.
But now I checked the full path of file. It was simply session save path was different than temporary files path. So I used same session path in both links and it worked for me.
Still Thank you guys to provide me help about it.
I am using ZendFramwork1, my local sever php 5.4. and with MongoDB .I have use function Zend_Pdf to draw PDF in my project. it's run well in my local server. but when i put code to sever that have same version PHP. Everything module is okay but for function print data to pdf is errors . I got message like PDF error: Can not open 'data/reports/myfile.pdf' file for writing. . Any one can help me . what's different between my local server and real sever ?
I am looking to see your reply soon.
thank
First off, chmod 777 is a hack and shouldn't really be used. If you're using apache, you are better off chown'ing the folder to the correct user.
I'm very frustrated with getting ImageMagick to run.
The Situation:
ImageMagick is installed on the Server. (My hosting provider did this. as a standard)
I asked my provider and they only said: the path to ImageMagick is /usr/bin/php_safemode and that i should "deposit" the path in my application. Whatever that means.
nothing works:
exec('convert SOME CODE') ;
doesn't work.
$im = new Imagick($image);
(these are no complete scripts, because not the scripts are the problem.. ) i have no idea how to test it. i mean ..no idea how to get it run. how to include this path in my script..
note: i have no access to php.ini or something like this.. my hosting provider told me that i can do it just include this path.. but how could this work?
Any ideas? tips?
i'm searching for an answer the whole day
Try this:
exec('/usr/bin/php_safemode/convert SOME CODE');