cakephp-docker icon indicating copy to clipboard operation
cakephp-docker copied to clipboard

unable to upload / view existing images already check folder permission is ok

Open GreenpacketSam opened this issue 6 years ago • 12 comments

please advise any setting for nginix as unable to view existing images and upload new images inside webroot/img/uploads

GreenpacketSam avatar Jun 29 '18 10:06 GreenpacketSam

2018/06/29 10:47:32 [error] 7#7: *3 client intended to send too large body: 1114982 bytes, client: 211.24.100.121, server: abc.com, request: "POST /paste-n-sells/edit/29 HTTP/1.1", host: "abc.com", referrer: "https://abc.com/paste-n-sells/edit/29" 2018-06-29 18:47:48 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Webroot could not be found. in /var/www/myapp/vendor/cakephp/cakephp/src/Http/ControllerFactory.php on line 89 Request URL: /webroot/img/pastensell_example.png Referer URL: https://abc.com/paste-n-sells/edit/29 Client IP: 211.24.100.121 Stack Trace: #0 /var/www/myapp/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(70): Cake\Http\ControllerFactory->missingController(Object(Cake\Http\ServerRequest)) #1 /var/www/myapp/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(63): Cake\Http\ControllerFactory->create(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response)) #2 /var/www/myapp/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(49): Cake\Routing\Filter\ControllerFactoryFilter->_getController(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response)) #3 /var/www/myapp/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\ControllerFactoryFilter->beforeDispatch(Object(Cake\Event\Event)) #4 /var/www/myapp/vendor/cakephp/cakephp/src/Event/EventManager.php(414): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response)) #5 /var/www/myapp/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event)) #6 /var/www/myapp/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event)) #7 /var/www/myapp/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(78): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array) #8 /var/www/myapp/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response)) #9 /var/www/myapp/webroot/index.php(36): Cake\Routing\Dispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response)) #10 {main}

GreenpacketSam avatar Jun 29 '18 10:06 GreenpacketSam

What size file are you trying to upload? The limit (set in the nginx.conf and the php overrides files) is 100 MB, with 108 MB page memory.

cwbit avatar Jun 30 '18 00:06 cwbit

file size is less than 1 MB also existing img also not showing ,, giving 404 not found , as i checked img already exisist

GreenpacketSam avatar Jun 30 '18 13:06 GreenpacketSam

Somethig about the POST is too large (see the first line of your error message). Might not be related to the image at all. What happens if you remove the upload peice temporarily (disable the form field) and try and edit?

cwbit avatar Jul 01 '18 15:07 cwbit

can i know where is php.ini is located i coudn't find it

GreenpacketSam avatar Jul 02 '18 09:07 GreenpacketSam

upload function using zebra_image library not sure why it's not working

GreenpacketSam avatar Jul 02 '18 09:07 GreenpacketSam

https://github.com/cwbit/cakephp-docker#myapp-php-fpm---the-php-processor

You can configure what PHP extensions are loaded by editing /php-fpm/Dockerfile You can configure PHP overrides by editing /php-fpm/php-ini-overrides.ini

cwbit avatar Jul 02 '18 14:07 cwbit

ok thanks dude! what about some subfolders page still can't view

GreenpacketSam avatar Jul 02 '18 15:07 GreenpacketSam

This project expects your entire cake app to be inside a cakephp folder in the root directory (same level as the docker folder) - unless you changed the defaults. All this is just a boilerplate server wrapper around the cake files to "containerize" your application. It shouldn't have any impact on the visibility of your pages unless you changed the nginx or php-fpm setup files, or aren't loading required libraries for plugins. (ie. imagick or gmagick image extensions)

cwbit avatar Jul 02 '18 15:07 cwbit

looking at the error message you posted, it looks like you're incorrectly accessing the image URL. leave out the webroot, that's implied. /img/pastensell_example.png NOT /webroot/img/pastensell_example.png

2018-06-29 18:47:48 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Webroot could not be found. in /var/www/myapp/vendor/cakephp/cakephp/src/Http/ControllerFactory.php on line 89
Request URL: /webroot/img/pastensell_example.png

cwbit avatar Jul 02 '18 15:07 cwbit

root@webcash:~/www/sandbox-nginx# cat nginx.conf server {

server_name  localhost;
listen 443 ssl;

root /var/www/myapp/webroot;
client_max_body_size 108M;

index index.php index.html;
ssl_certificate /etc/letsencrypt/webcash2018.crt;
ssl_certificate_key /etc/letsencrypt/server.key;
access_log /var/www/myapp/nginx.access.log;
error_log /var/www/myapp/nginx.error.log;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers   on;
#sendfile off;

location / { try_files $uri /index.php?$args; }

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass myapp-php-fpm:9000;
    include fastcgi.conf;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_intercept_errors on;
}

}

GreenpacketSam avatar Jul 02 '18 16:07 GreenpacketSam

bro if you can help me :) not sure where i am doing wrong,

GreenpacketSam avatar Jul 02 '18 16:07 GreenpacketSam