How to create an archive with Zippy on Laravel 4? - php

I use Laravel 4 framework for PHP and have successfully added this module called Zippy for creating archive files but it seems to be bouncing back an error saying
Unable to create archive
Please can you suggest a solution for a different package or how to get around with this error?
PHP Code:
use Alchemy\Zippy\Zippy;
$zip = Zippy::load();
$zip->create('testingit.zip', array(
"assets/img/logo.png"
),$recursive = true);

I recently had this problem in one server and the solution was these two things:
Make sure zip is installed
sudo apt-get install zip or yum install zip unzip
Make sure your enviroment variable PATH is set using phpinfo() or getenv('PATH')
In my case I' using php-fpm, I just had to add this line in /etc/php5/fpm/pool.d/www.conf
env[PATH] = /usr/local/bin:/usr/bin:/bin

Related

Laravel Snappy PDF Exit Status Code 127

I am trying to print a HTML to PDF file for hardcopy and file purposes of my project in Laravel. I tried to use the barryvdh/laravel-snappy so I followed the documentations carefully and I also installed this wkhtmltopdf for ubuntu 16.04 64x bit cause I think it is required in order to use this package. But there is a big problem. When I generate a PDF sample using Snappy it gives me this error.
Is there something wrong in the installation of my wkhtmltopdf? or is it a directory issue? I tried to sudo chmod -R 777 usr/bin/wkhtmltopdf but still got the same error.
I also followed this this link to help me out. But ended up in the same error.
Looking for help.
Thanks in advance.
Btw I am using Ubuntu 17.10 64-bit
wkhtmltodf version - 0.12.3.2
I would suggest you to use the below package for integrating PDF feature.
I personally use this and its working great and easy to use.
https://github.com/barryvdh/laravel-dompdf
If you came across any issue using this plugin please ask me i will help you out for sure.
E.g
Make sure to install and configure this package as mention in the document also make sure to run the below command after installation and configuration of this package.
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
then try using the below code:
$date = Carbon::now()->format('j F, Y');
data = ['date'=>$date];
$pdf = PDF::loadView('admin.pages.application', $data)->setPaper('a4');
return $pdf->download('download.pdf');
on my Ubuntu 20.04 i had to install a few more dependencies for it to work
Edit this file /etc/apt/sources.list and add this line to the end of it: deb http://security.ubuntu.com/ubuntu bionic-security main
After that run: sudo apt update && apt-cache policy libssl1.0-dev
Finally: sudo apt-get install libssl1.0-dev
And finish with: sudo apt-get install libxrender1
Please give 777 permission to vendor folder and then check it

TYPO3 can't access to root folder

I am new in TYPO3, I have a running system online and wanted to copy to my localhost, I copied the folder in /var/www/my_production/
I created the database, I can access to the backend without problem but I cant open my site, I get this error :
1323059807: You are not allowed to create directories in the folder "/" (More information)
TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException
thrown in file
/var/www/my_production/typo3/sysext/core/Classes/Resource/ResourceStorage.php
in line 2021.
Any idea how I can fix that problem?
EDIT ::
After clearing the cache from the Install Tool, I got :
Fatal error: Call to undefined function
TYPO3\CMS\Core\Utility\xml_parser_create() in
/var/www/clevvermail_dev/typo3/sysext/core/Classes/Utility/GeneralUtility.php
on line 2252
One possible cause is that XML is missing.
Try: sudo apt-get install php7.0-xml or sudo apt-get install php5.6-xml
First steps for each new TYPO3 installation: enter Install Tool and reduce all errors possible. (You might stay with some errors, but you need to understand them.)
TYPO3 gives a lot of hints what has to be changed.
typical errors:
missing directories
missing rights in directories
wrong configuration in php.ini
missing php modules
database errors (connection, user, password)
try to solve these errors first.
Since TYPO7 you can check your extensions from the Install Tool.
For earlier versions:
disable all additional extensions (in PackagesState.php) and get the core working, then enable one extension after the other.

WebSVN doesn't recognize repositories

I am trying to install WebSVN. Everything worked fine so far but my repositories are not recognized.
Inside my user folder /home/svn (svn is the user name) I have several repositories and I want all of them to appear in WebSVN.
This is my config.php:
<?php
$config->setSVNCommandPath('/usr/bin');
$config->setDiffPath('/usr/bin');
$config->setEnscriptPath('/usr/bin');
$config->setSedPath('/bin');
$config->setTarPath('/bin');
$config->setGZipPath('/bin');
$config->parentPath('/home/svn');
$config->addTemplatePath($locwebsvnreal.'/templates/calm/');
$config->addTemplatePath($locwebsvnreal.'/templates/BlueGrey/');
$config->addTemplatePath($locwebsvnreal.'/templates/Elegant/');
$config->addInlineMimeType('text/plain');
$config->setMinDownloadLevel(2);
$config->useGeshi();
set_time_limit(0);
$config->expandTabsBy(8);
$extEnscript[".pl"] = "perl";
$extEnscript[".py"] = "python";
$extEnscript[".sql"] = "sql";
$extEnscript[".java"] = "java";
$extEnscript[".html"] = "html";
$extEnscript[".xml"] = "html";
$extEnscript[".thtml"] = "html";
$extEnscript[".tpl"] = "html";
$extEnscript[".sh"] = "bash";
If I open WebSVN in a browser, it shows an HTTP ERROR 500. If I change the line $config->parentPath('/home/svn'); to $config->parentPath('/home'); it keeps telling me:
Please set up a repository in include/config.php using
$config->parentPath or $config->addRepository. See the installation
guide for more details.
Am I missing something?
With all things set, I also kept experiencing this issue. Browsing the Apache error log file I encountered an interesting bit regarding a missing xml function (using Ubuntu 16.04 LTS, the default php installation which is 7.0 at the time being). This could be easily solved by installing php-xml with
apt-get install php-xml -y
Hope this is your case as well.
In addition to telling WebSVN where to find your repositories with parentPath (which just lets you shorten later paths), you have to create one entry (using addRepository) per repository that you want to display on the WebSVN home page.
The addRepository() function takes two arguments. The first is the visible name, the second is the path to the SVN repository.
Reference link: Use Subversion, Apache, and WebSVN to view your repositories
(It's been a while since I setup WebSVN, but I did have to list each one individually.)
Add a repository using the below command
$ svnadmin create --fs-type fsfs /home/svn/FirstRepo
then
Add a line with your first repository like below in your config.php
$config->addRepository("FirstRepo", "file:///home/svn/FirstRepo");
and also install php-xml.
$ sudo apt install -y php-xml
Restart the apache2 server.
$ sudo apache2 restart

Unable to install wordpress theme - ubuntu

I recently created an ubuntu virtual server(EC2) on Amazon Web Services, then installed wordpress through console apt-get install wordpress , before that I installed, apache, php and mysql. The website is running, but the problem is that I can't install wordpress themes, I get this message:
Downloading install package from https://downloads.wordpress.org/theme/twentysixteen.1.1.zip…
Unpacking the package…
Could not create directory.
I already give the right permissions to these folders :
usr/share/wordpress/wp-content,
usr/share/wordpress/wp-content/themes,
usr/share/wordpress/wp-content/plugins,
usr/share/wordpress/wp-content/languages
And added this line:
define('FS_METHOD','direct');
to usr/share/wordpress/wp-config.php
at the end.
I don't know what else to do.
Thank you.
I recently figure out how to fix it, I edited this file:
/etc/wordpress/config-mydomain.com.php
And found this line:
define('WP-CONTENT-DIR','srv/www/wp-content/localhost');
This must be replaced by:
define('WP-CONTENT-DIR','var/www/html/wordpress/wp-content');
This often happen when you use this file to create your database and setup your files in ubuntu: usr/share/doc/wordpress/examples/setup-mysql
And then you can install themes without problems, but you must give aproppiate permissions to the folders wp-content, themes, etc. after fix this!!
You could try defining the content directory
define('WP_CONTENT_DIR', '/var/www/wordpress/wp-content');

Pyrus problems on Ubuntu 12 installing ZF2

I tried to install zend framework 2 on Ubuntu 12.04.1 64 bit but have run into difficulties.
# sudo pyrus install zf2/Zend_Framework-beta#Standard
failed mid transaction with no other previous errors that I can recall other than warnings about timezone not being set. ( Unfortuantely my terminal history has lost the original output)
Pyrus\Installer\Exception: Installation failed
Pyrus\AtomicFileTransaction\MultiException: ERROR: commit failed
Pyrus\IOException: CRITICAL - unable to complete transaction, rename of actual to backup path failed
Pyrus\AtomicFileTransaction\RuntimeException: Cannot rollback - not in a transaction
Now when I try to rerun
# sudo pyrus install -f zf2/Zend_Framework-beta#Standard
it fails with
Pyrus\Registry\Exception: Cannot retrieve package file object for package packages.zendframework.com/zend_framework, it is not installed
Uninstall just tells me that it's not installed.
I restored /usr/share/.old-php to /usr/share/php however I still get the same error.
Please help.
You can just try to download and unzip Zend Framework 2 archive into your project's library folder.
It looks like it's a problem with the metapackage according the Matthew. I'm having the same problem.
Error Installing full framework with Pyrus
So if I installed pyrus here: "/usr/share/pear/pyrus" , then should I create a directory "/usr/share/pear/pyrus/zf2" and download and unzip the full Zend Framework in zf2 and it should work?
thanks

Categories