Yii - How to cause Yii to republish to the assets folder - yii

Yii question.
On my development machine, the required JQuery files for the application were present in a subfolder under the assets folder. However, when I copied the application to my test server, JQuery files were missing in the folder yii looked for them. I kept getting errors such as '../assets/db0e5a94/jquery.ba-bbq.js' 404 not found, etc.
I emptied the assets folder, and now all my CSS files etc. are reported missing. Is there any way I can cause Yii to republish to the assets folder?
Thanks!

Simply delete all sub-directories in the assets folder and clear your browser cache. Do not delete the assets directory or you will have to set the write permissions again.

in components/Controller.php add the following function:
protected function beforeAction($action){
if(defined('YII_DEBUG') && YII_DEBUG){
Yii::app()->assetManager->forceCopy = true;
}
return parent::beforeAction($action);
}

A simple way to have your assets back is to manually copy them from framework directory back. I know it is not the best way to do it, but it should help you while you find a better solution.

Ask your hosting service provider to disable SAFE_MODE in php.ini. Then remove asstes directory together with its sub files and folders and create it again. Make sure that you set CHMOD to 0777 for the new directory you just created.

I also had this same problem. After uploading the respective files to the server i changed the file permission to 755 in the server. Then it worked.

Related

How to generate txt & xml files in nuxt SSR?

Is there any way of generating a Google : ads.txt file every time i build my SSR project?
There is a module called: sitemap-module from nuxt-community, it is used to generate a sitemap xml file, and that file can be accessed by http://domain.tls/sitemap.xml. and i want something like that.
So currently i'am achieving this by building the project, then manually put ads.txt it in : /var/www/site/.nuxt/dist/client/,
The problem with this is that everytime i rebuild the project i loose /var/www/site/.nuxt/dist/client/ folder then i have to add ads.txt file again.
I would like to know how i can hook up my code to tell nuxt to generate ads.txt file and put it in /var/www/site/.nuxt/dist/client/
Not sure if it makes sense, but i hope someone will understand.
Place your ads.txt file in a directory named static as mentioned here. All the contents of the static directory can be accessed via example.com/{filename.extension}
If you are not using nuxt.js and just using vue js, place it in a public directory right next to src directory.
Haven't found any way of solving this in nuxt, so i decided to redirect all https://domain.tld/ads.txt in Nginx configuration.
/etc/nginx/sites-available/default.conf
#redirect all txt request
location ~* ^.+.(txt)$ {
root /var/www/other.files/;
}
So i think i'll stick to it.

Where should I place my app's yiic file to execute console commands?

When you generate Yii 1.x auto-generated application, app's private yiic is placed in protected folder. However, when I use it to execute yiic help shell, I see following message:
It is recommended that you execute this command under
the directory that contains the entry script file of
the Web application.
And then:
* entry-script | config-file: optional, the path to
the entry script file or the configuration file for
the Web application. If not given, it is assumed to be
the 'index.php' file under the current directory.
What am I missing? The protected folder is not the same folder as entry script's one (index.php). Should I move my yiic there for the purpose of executing console commands?
If yes, then why yiic is placed protected folder by default, not there, where entry script is?
If not, then why yiic assumes, that index.php exists in the same folder as yiic itself and why do I have to change this every time with using entry-script flag? This just doesn't make any sense!
I think, the answer is to keep yiic in protected folder, which is secured from web access by .htaccess file. Entry script's folder is not secured that way and is web accessible. I would personally be very worried about moving yiic to root folder, where index.php file exists. If this is the correct answer, then what is the purpose of this confusing message, cited above?
This answer seems to be supporting my idea, as it shows that CRON call should point to yiic placed in protected folder, not to the one in root folder.
Why Yii developers put yiic, where it is not supposed to be (it is looking for index.php in the same folder, so in default auto-generated application, it will fail, not finding it)? How should I understand this situation? Why I'm forced to use extra flag every time? Why default folder structure and file placement does not replicate, what yiic assumes as default?
What the help message means is that you should execute the yiic command from the WebRoot folder (where your index.php is) like so:
% cd WebRoot
% YiiRoot/framework/yiic shell
So yii will take automatically your index.php file to do its things...
But if you want to call another file like index-test.php to get yii executed instead of the default index.php you can:
% cd WebRoot
% YiiRoot/framework/yiic shell index-test.php
http://www.yiiframework.com/doc/guide/1.1/en/topics.console

Laravel wrong public path file upload

I've deployed laravel with this guide.
http://juniorgrossi.com/deploying-laravel-applications-on-a-shared-host/
On my webserver I have a public_html file now containing all my publicly accesable files and a laravel folder containing the rest, so I've split up the default laravel structure for deployment.
On my development server by default the public folder is resting inside the laravel folder instead of being on the same directory level.
The problem I'm getting though is when I use something like this:
// Upload the file
Input::upload('image', 'public/uploads', $filename);
Same with this.
// Upload the file
Input::upload('image', path('public') . 'uploads', $filename);
Instead of trying to use the uploads folder that is inside my public_html folder it tries looking for a public file inside my laravel folder now.
And I get a
Unable to create the "/uploads" directory
Ofcourse on my development server the public folder is still inside the folder so it's logical.
How do I fix this?
You may try this (add a slash after the folder name)
Input::upload('image', path('public') . 'uploads/', $filename);
Maybe try this....just as a test
Input::upload('image', URL::to_asset('uploads/'), $filename);
You can also try
Intervention/image package.
I'm using this and I find it very easy to use. It also has a resize and crop feature.
It's easy as:
Image::make(Input::file('file')->getRealPath())->save('uploads/' . $filename);
Fixed the paths.php to ../public_html
I've done this before but it failed since I accidentaly uploaded a png and my jcrop function wich crops and saves images failed because it currently onlt takes jpg. So that left me thinking my paths.php settings were no good while they actually were.
Thanks for helping out though everybody!
(I feel like a fool.)
In my case, I got the same problem. Then I created it manually, CHMODed the lil' bastard and it worked fine!
Making a long history short (not so long...): just permission!
If you have the permission to Write/Read to the folder, you'll be cool! If you don't, you change the permissions! If you are unable to change it, put the uploaded files where the permissions allows you to access the file.

Getting jQuery Error on using ezzeelfinder

Hi I am trying to use ezzeelfinder as file manager
I am getting the following error:
TypeError: jQuery(selector).elfinder is not a function
Query(selector).elfinder().elfinder("instance");
I am using the exact code from the Yii extension website. I do not know what is going wrong, I am using windows 7 with Apache (XAMPP)?
Continuing our discussion from previous ElFinder question let me try to explain more.
Can you look at what is inside elfinder.min.js file included from assets directory (you can use Firebug: Net tab > expand request of /assets/abcdef/elfinder.min.js > Response tab)? It wasn't a script (but some HTML with error) when I've reproduced a problem with such error. So if this JavaScript file is not included then there is no elfinder method extending jQuery and the error message you receive is fair.
Seems to me that this one is a permission issue. elfinder.min.js file cannot be published to assets directory for some reasons. Make sure that all permissions to elfinder.min.js file WITHIN extension's directory are granted. After granting the permissions to this file clean up assets directory and try again. At last, check whether the script has been really published to assets directory and has granted permissions there.
I don't know whether it will be helpful for you but I have an archive with demo files that can demonstrate extension's basic usage (made under Ubuntu though): http://ezze.org/yii/ezzeelfinderdemo.zip
Extract the contents of this archive to the root folder of Yii basic application created from command line using yiic script.

Playframework - Uploadfile to 2 different folders

just starting at play, and I needed to see it it can be used to do my project.
But after reading some docs, I still can't find a way to put uploaded files in more then one place.
I know that there is the attachments folder, and that I can change it directory in the confs, but what I want is another attachments folder, some thing like:
If the user upload a photo it would go to /photos folder;
if the user upload a txt it would go to /docs fodler;
Thanks
--UPDATE--
I'm using Play 2.0.1
So after some more research I found this other question:
How can I change uploaded files directory in play 2.0.1?
Basically there is no more attachments path configure in this playframework version, so I need to put this manually in the control, just like the answer in that question.