croot / my-imouto-booru

Automatically exported from code.google.com/p/my-imouto-booru
0 stars 0 forks source link

Permission denied to write files #222

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
** If you can, please create one issue entry per error **

What steps will reproduce the problem?
1. connect to 127.0.0.1:3000
2. error
3.

What is the expected output? What do you see instead?
my booru homepage

What version of the product are you using? On what operating system?
1.0.5, php 5.4.9, xampp, ubuntu linux 12.04

Please provide any additional information below.
I configured my imouto booru and when I started it I first came into the error

Parse error: syntax error, unexpected ''192.168.1.1'' 
(T_CONSTANT_ENCAPSED_STRING), expecting ']' in 
/opt/lampp/htdocs/myimouto/config/application.php on line 32
so I deleted all "safe-ips" from application.php but 127.0.0.1

when I reloaded 127.0.0.1:3000 I got this error:

Fatal error: Uncaught exception 'Rails_Exception_PHPError_Warning' with message 
'fopen(/opt/lampp/htdocs/myimouto/log/error.log): failed to open stream: 
Permesso negato ' in /opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php:238 
Stack trace: #0 /opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php(374): 
Rails::raise('Rails_Exception...', '%s ', Array, Array) #1 [internal function]: 
Rails::error_handler(2, 'fopen(/opt/lamp...', '/opt/lampp/htdo...', 288, Array) 
#2 /opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php(288): 
fopen('/opt/lampp/htdo...', 'a') #3 
/opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php(435): Rails::log_error('PHP 
Warning?mkd...', false) #4 
/opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php(381): 
Rails::_report_exception(Object(Rails_Exception_PHPError_Warning)) #5 [internal 
function]: Rails::exception_handler(Object(Rails_Exception_PHPError_Warning)) 
#6 {main} thrown in /opt/lampp/htdocs/myimouto/vendor/Rails/Rails.php on line 
238

Original issue reported on code.google.com by ainselvi...@gmail.com on 25 Oct 2013 at 5:24

GoogleCodeExporter commented 9 years ago
UPDATE: I tried manually creating myimouto/log/error.log and now I get this 
error:

 Parse error: syntax error, unexpected 'version' (T_STRING) in /opt/lampp/htdocs/myimouto/app/views/exception/500.php on line 1

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 5:42

GoogleCodeExporter commented 9 years ago
UPDATE_2: I did some research on stack overflow, apparently I have to turn 
short_open_tag off in php.ini (there are 3 occurrences of it BTW) (Also, should 
you put that on the install guide? Idk. I think it's on by default, because I 
didn't change it)

Now I just get "Error Occurred." as error.
It's like some kind of sick game
Each level is more difficult than the one before
Will it ever end?
Please help me! Thank you.

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 7:03

GoogleCodeExporter commented 9 years ago
UPDATE_3: Last time I didn't even get an error message. That makes solving this 
problem almost impossible. But I'm smarter than whoever is trolling me and 
checked 
/opt/lampp/htdocs/myimouto/log/error.log
this is what it said:

[25-Oct-2013 19:39:51 CEST] [GET] /
PHP Warning
mkdir(): Permesso negato 
/vendor/Rails/Cache/Entry.php (66)
array(3) {
  ["val"]=>
  array(2) {
    [0]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/javascripts"
    [1]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/stylesheets"
  }
  ["params"]=>
  array(0) {
  }
  ["header"]=>
  string(0) ""
}

#0 Rails/Cache/Entry.php(66): mkdir(/opt/lampp/htdo..., 511, 1)
#1 Rails/Cache.php(19): Rails\Cache\Entry->write(Array, Array)
#2 Rails/Assets.php(351): Rails\Cache->write(RAILS_ASSETS_CA..., Array, Array)
#3 Rails/Assets.php(41): Rails\Assets->cache_write(RAILS_ASSETS_CA..., Array)
#4 Rails/Rails.php(195): Rails\Assets->__construct()
#5 install/form.php(43): Rails::assets()
#6 install/setup.php(82): require(/opt/lampp/htdo...)
#7 install/setup.php(46): MyImouto_Setup->_show_install_form()
#8 public/index.php(4): MyImouto_Setup->run()
#9 {main}

[25-Oct-2013 19:39:51 Europe/Rome] PHP Parse error:  syntax error, unexpected 
'version' (T_STRING) in /opt/lampp/htdocs/myimouto/app/views/exception/500.php 
on line 1
[25-Oct-2013 19:55:38 CEST] [GET] /
PHP Warning
mkdir(): Permesso negato 
/vendor/Rails/Cache/Entry.php (66)
array(3) {
  ["val"]=>
  array(2) {
    [0]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/javascripts"
    [1]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/stylesheets"
  }
  ["params"]=>
  array(0) {
  }
  ["header"]=>
  string(0) ""
}

#0 Rails/Cache/Entry.php(66): mkdir(/opt/lampp/htdo..., 511, 1)
#1 Rails/Cache.php(19): Rails\Cache\Entry->write(Array, Array)
#2 Rails/Assets.php(351): Rails\Cache->write(RAILS_ASSETS_CA..., Array, Array)
#3 Rails/Assets.php(41): Rails\Assets->cache_write(RAILS_ASSETS_CA..., Array)
#4 Rails/Rails.php(195): Rails\Assets->__construct()
#5 install/form.php(43): Rails::assets()
#6 install/setup.php(82): require(/opt/lampp/htdo...)
#7 install/setup.php(46): MyImouto_Setup->_show_install_form()
#8 public/index.php(4): MyImouto_Setup->run()
#9 {main}

[25-Oct-2013 19:55:38 Europe/Rome] PHP Parse error:  syntax error, unexpected 
'version' (T_STRING) in /opt/lampp/htdocs/myimouto/app/views/exception/500.php 
on line 1
[25-Oct-2013 19:55:44 CEST] [GET] /
PHP Warning
mkdir(): Permesso negato 
/vendor/Rails/Cache/Entry.php (66)
array(3) {
  ["val"]=>
  array(2) {
    [0]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/javascripts"
    [1]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/stylesheets"
  }
  ["params"]=>
  array(0) {
  }
  ["header"]=>
  string(0) ""
}

#0 Rails/Cache/Entry.php(66): mkdir(/opt/lampp/htdo..., 511, 1)
#1 Rails/Cache.php(19): Rails\Cache\Entry->write(Array, Array)
#2 Rails/Assets.php(351): Rails\Cache->write(RAILS_ASSETS_CA..., Array, Array)
#3 Rails/Assets.php(41): Rails\Assets->cache_write(RAILS_ASSETS_CA..., Array)
#4 Rails/Rails.php(195): Rails\Assets->__construct()
#5 install/form.php(43): Rails::assets()
#6 install/setup.php(82): require(/opt/lampp/htdo...)
#7 install/setup.php(46): MyImouto_Setup->_show_install_form()
#8 public/index.php(4): MyImouto_Setup->run()
#9 {main}

[25-Oct-2013 19:55:44 Europe/Rome] PHP Parse error:  syntax error, unexpected 
'version' (T_STRING) in /opt/lampp/htdocs/myimouto/app/views/exception/500.php 
on line 1
[25-Oct-2013 20:55:46 CEST] [GET] /
PHP Warning
mkdir(): Permesso negato 
/vendor/Rails/Cache/Entry.php (66)
array(3) {
  ["val"]=>
  array(2) {
    [0]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/javascripts"
    [1]=>
    string(49) "/opt/lampp/htdocs/myimouto/app/assets/stylesheets"
  }
  ["params"]=>
  array(0) {
  }
  ["header"]=>
  string(0) ""
}

#0 Rails/Cache/Entry.php(66): mkdir(/opt/lampp/htdo..., 511, 1)
#1 Rails/Cache.php(19): Rails\Cache\Entry->write(Array, Array)
#2 Rails/Assets.php(351): Rails\Cache->write(RAILS_ASSETS_CA..., Array, Array)
#3 Rails/Assets.php(41): Rails\Assets->cache_write(RAILS_ASSETS_CA..., Array)
#4 Rails/Rails.php(195): Rails\Assets->__construct()
#5 install/form.php(43): Rails::assets()
#6 install/setup.php(82): require(/opt/lampp/htdo...)

I think the most relevant part here is 
mkdir(): Permesso negato
Permesso negato is italian for Permission denied

So this all could be just a permission problem
But I have the ownership of htdocs AND subfolders
should I chmod -R 777 on it?

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 7:10

GoogleCodeExporter commented 9 years ago
The system doesn't have permissions to write files. Try giving it permissions 
for log, install, tmp and public folders.

The first error on "safe_ips" was a parse error. I can reproduce the problem by 
omitting a comma in an array:

[ 'foo' 'bar' ]

while it should be like this:

[ 'foo', 'bar' ]

Apparently you forgot the comma while listing your IP~

About short open tags, there was another report about the same error (I set the 
issue as "done" some days ago, so it's not listed by default anymore). The 
thing is I didn't think about short tags being turned on in some systems.

Original comment by asterixvader on 25 Oct 2013 at 7:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
(Why did you remove your comment?)

I have a similar problem with my Ubuntu VM. Apache2 has its own user called 
www-data, but then I manipulate files with my user... so sometimes my user 
creates a folder, but www-data can write files on it. Or something like that.

Appliying "sudo chmod 777 -R folder" through console solves this, although 
that's not the most professional fix.

Original comment by asterixvader on 25 Oct 2013 at 9:15

GoogleCodeExporter commented 9 years ago
Thank you for your advice. About the safe_ips array, having made such a mistake 
is a bit embarassing because I'm a programmer (Java).
Giving permissions DID resolve the problem, but after seeing the config screen 
(finally! It took me 3 days to configure everything like xampp, ubuntu, vnc, 
ssh etc)
and entering username and password I get 
Fatal error: Cannot redeclare class PostFilenameParsingMethods in 
/opt/lampp/htdocs/myimouto/app/models/post/filename_parsing_methods.php on line 
3
From the log:
[25-Oct-2013 23:47:26 Europe/Rome] PHP Notice:  Undefined index: admin_name in 
/opt/lampp/htdocs/myimouto/install/setup.php on line 130
[25-Oct-2013 23:47:26 Europe/Rome] PHP Notice:  Undefined index: admin_password 
in /opt/lampp/htdocs/myimouto/install/setup.php on line 131
[25-Oct-2013 23:47:26 CEST] [POST] /user/error.json
Error on database query execution
[SQLSTATE 23000] (1048) Column 'name' cannot be null
Query: INSERT INTO users (created_at, name, password_hash, level, 
show_advanced_editing) VALUES (?, ?, ?, ?, ?)
Values: array (
  0 => '2013-10-25 23:47:26',
  1 => NULL,
  2 => 'e4591d99cd7e632d30cc86bef922b47517d95617',
  3 => 50,
  4 => 1,
)

[25-Oct-2013 23:47:26 CEST] [POST] /user/error.json
Error on database query execution
[SQLSTATE 23000] (1452) Cannot add or update a child row: a foreign key 
constraint fails (`myimouto`.`user_blacklisted_tags`, CONSTRAINT 
`fk_user_bl_tags__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON 
DELETE CASCADE)
Query: INSERT INTO user_blacklisted_tags VALUES (?, ?)
Values: array (
  0 => '0',
  1 => 'rating:q

rating:e',
)

[25-Oct-2013 23:47:27 Europe/Rome] PHP Fatal error:  Cannot redeclare class 
PostFilenameParsingMethods in 
/opt/lampp/htdocs/myimouto/app/models/post/filename_parsing_methods.php on line 
3
[25-Oct-2013 23:55:22 Europe/Rome] PHP Fatal error:  Cannot redeclare class 
PostFilenameParsingMethods in 
/opt/lampp/htdocs/myimouto/app/models/post/filename_parsing_methods.php on line 
3
[26-Oct-2013 00:04:24 Europe/Rome] PHP Fatal error:  Cannot redeclare class 
PostFilenameParsingMethods in 
/opt/lampp/htdocs/myimouto/app/models/post/filename_parsing_methods.php on line 
3

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:06

GoogleCodeExporter commented 9 years ago
lol.
err... mm does the file 
"myimouto/app/models/post/filename_parsing_methods.php.example" exist? if so, 
delete it.

Original comment by asterixvader on 25 Oct 2013 at 10:12

GoogleCodeExporter commented 9 years ago
no it does not but I had a copy of filename_parsing_methods.php with a 
different filename that's all

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:19

GoogleCodeExporter commented 9 years ago
I guess deleting that file fixed the problem.

Original comment by asterixvader on 25 Oct 2013 at 10:20

GoogleCodeExporter commented 9 years ago
 i deleted filename_parsing_methods.php (w/o example) and imouto SEEMS to be working.
BUT I can't see an image i uploaded
I see the post but not the image
log:
[26-Oct-2013 00:28:14 CEST] [GET] 
/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg
Routing Error
No route matches [GET] 
"/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg"

[26-Oct-2013 00:28:27 CEST] [GET] 
/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg
Routing Error
No route matches [GET] 
"/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg"

[26-Oct-2013 00:28:43 CEST] [GET] 
/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg
Routing Error
No route matches [GET] 
"/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg"

[26-Oct-2013 00:28:44 CEST] [GET] 
/post/show/127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:30

GoogleCodeExporter commented 9 years ago
I think this is a config problem

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:31

GoogleCodeExporter commented 9 years ago
Can you upload your config.php file?

Original comment by asterixvader on 25 Oct 2013 at 10:37

GoogleCodeExporter commented 9 years ago
here

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:41

Attachments:

GoogleCodeExporter commented 9 years ago
url_base should be "http://127.0.0.1:3000", it's missing the "http://" part.

Original comment by asterixvader on 25 Oct 2013 at 10:46

GoogleCodeExporter commented 9 years ago
<?php
# This is the file you use to overwrite the default config values.
# Look at default_config.php and copy over any settings you want to change.

class Moebooru_Config extends Moebooru_DefaultConfig
{
    public $app_name      = 'my.imouto';

    public $server_host   = '127.0.0.1:3000';

    public $url_base      = 'http://127.0.0.1:3000';

    public $admin_contact = 'admin@myimouto';
Still not working

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:54

GoogleCodeExporter commented 9 years ago
I even tried to make another post but... nothing

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 10:54

GoogleCodeExporter commented 9 years ago
Are you accessing the file from the same machine that is hosting the system?

Original comment by asterixvader on 25 Oct 2013 at 10:58

GoogleCodeExporter commented 9 years ago
yes but i want to make my server public in the near future

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:00

GoogleCodeExporter commented 9 years ago
It's the same machine and yet you can't see the posts?
Please manually check if the files were successfuly created. Check the 
generated URL in the <img> tags.

Original comment by asterixvader on 25 Oct 2013 at 11:03

GoogleCodeExporter commented 9 years ago
i can see the images at 
127.0.0.1:3000/data/image/4eb481705b2e27d4ab9c2586c16ca7ab.jpg for example and 
i see the posts but the images aren't displayed in the posts

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:06

GoogleCodeExporter commented 9 years ago
The corresponding file for that image (public/data/image/4e/b4/4eb4....jpg) 
exists, and if you go to that address the image is loaded succesfuly, but when 
you go to the view page (/post/show/...) the image isn't displayed?

Can you check what is the URL created for the image in the corresponding <img> 
tag?

Original comment by asterixvader on 25 Oct 2013 at 11:10

GoogleCodeExporter commented 9 years ago
<img alt="ubuntu" id="image" class="image" width="1500" height="844" 
large_width="1920" large_height="1080" 
src="127.0.0.1:3000/data/sample/f60bedfc2412fc0c0275b43b7feada57.jpg" />      
</div>
I think the problem is what you said before, there's no http:// so it thinks 
127.0.0.1:3000 is a subdirectory 

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:18

GoogleCodeExporter commented 9 years ago
That's a malformed URL, it's missing the scheme (https://). That URL is 
appended to the current URL, so it ends up being something like noted in the 
errors above:

http://127.0.0.1/post/show/2/tags/127.0.0.1/data/sample......jpg.

The problem resides in the config. Please check and double check it.

Original comment by asterixvader on 25 Oct 2013 at 11:23

GoogleCodeExporter commented 9 years ago
<?php
# This is the file you use to overwrite the default config values.
# Look at default_config.php and copy over any settings you want to change.

class Moebooru_Config extends Moebooru_DefaultConfig
{
    public $app_name      = 'my.imouto';

    public $server_host   = 'http//127.0.0.1:3000/';

    public $url_base      = 'http://127.0.0.1:3000/';

    public $admin_contact = 'admin@myimouto';
}

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:27

GoogleCodeExporter commented 9 years ago
besides even the default config is almost identical

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:28

GoogleCodeExporter commented 9 years ago
corrected the missing :

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:29

GoogleCodeExporter commented 9 years ago
$server_host must not include the scheme, $url_base must include the scheme. 
And both must not include trailing slash:

class Moebooru_Config extends Moebooru_DefaultConfig
{
    public $app_name      = 'my.imouto';

    public $server_host   = '127.0.0.1:3000';

    public $url_base      = 'http://127.0.0.1:3000';

    public $admin_contact = 'admin@myimouto';
}

Original comment by asterixvader on 25 Oct 2013 at 11:31

GoogleCodeExporter commented 9 years ago
changed to:
public $server_host   = 'ghfhfgfg';

public $url_base      = 'hgfhfg/';
reload site
still same url in source
something's wrong here

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Quote: 
$server_host must not include the scheme, $url_base must include the scheme. 
And both must not include trailing slash
Believe me, I tried every combination of slash and scheme

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:36

GoogleCodeExporter commented 9 years ago
lol. Try reloading the server. Try causing a syntax error to see if the file is 
actually being included D:

Original comment by asterixvader on 25 Oct 2013 at 11:37

GoogleCodeExporter commented 9 years ago
tried to cause synthax error. No message. I am 100% sure it's the right file 
and I reopen it after each edit so I know it's being saved. Restarded apache, 
no results

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:42

GoogleCodeExporter commented 9 years ago
<?php
# This is the file you use to overwrite the default config values.
# Look at default_config.php and copy over any settings you want to change.

class Moebooru_Config extends Moebooru_DefaultConfig
{
    public $app_name      = 'my.imouto';

    public $server_host   3/0 lolololol;

    public $url_base      = lolololo;

    public $admin_contact = 'admin@myimouto';
}

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:42

GoogleCodeExporter commented 9 years ago
this can't possibly be a valid synthax, can it?

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:43

GoogleCodeExporter commented 9 years ago
lol~
Ok there's something wrong. There's something that is really wrong. But I have 
no idea what it is. Cache or something maybe, I don't know D:

Original comment by asterixvader on 25 Oct 2013 at 11:45

GoogleCodeExporter commented 9 years ago
WOOOOORKS

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:48

GoogleCodeExporter commented 9 years ago
IDK what happened

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:49

GoogleCodeExporter commented 9 years ago
No way that's a valid syntax. I get this:

Parse error: syntax error, unexpected '3' (T_LNUMBER), expecting ',' or ';' in 
/....../myimouto/config/config.php on line 14

Original comment by asterixvader on 25 Oct 2013 at 11:49

GoogleCodeExporter commented 9 years ago
Oh I see it now

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:49

GoogleCodeExporter commented 9 years ago
Maybe some cache somewhere. I once came accross a similar problem, had to 
restart Apache.

If you get more errors, let me know.

Original comment by asterixvader on 25 Oct 2013 at 11:50

GoogleCodeExporter commented 9 years ago
No actually I'm not sure

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:51

GoogleCodeExporter commented 9 years ago
Thank you for your support and patience.

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:51

GoogleCodeExporter commented 9 years ago
One more thing: can I open my booru to the web?

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:52

GoogleCodeExporter commented 9 years ago
Yes you can... you mean using your computer as host? You can but you'd need to 
set things up, like opening ports and stuff.

Original comment by asterixvader on 25 Oct 2013 at 11:57

GoogleCodeExporter commented 9 years ago
no I mean how do I access from a not-safe ip
I already set the ports and everything

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:59

GoogleCodeExporter commented 9 years ago
I mean how to deactivate the whitelist

Original comment by ainselvi...@gmail.com on 25 Oct 2013 at 11:59

GoogleCodeExporter commented 9 years ago
I set the imouto up so that it uses my domain now but I can't access it from 
devices not in the whitelist

Original comment by ainselvi...@gmail.com on 26 Oct 2013 at 12:02

GoogleCodeExporter commented 9 years ago
Oh, safe-ips are only used when installing and updating.

Original comment by asterixvader on 26 Oct 2013 at 12:04

GoogleCodeExporter commented 9 years ago
ahhhhhh thank you, that's all I wanted to hear.
Ok I was fearing this was a Local only booru. So now everything works.
Thank you.

Original comment by ainselvi...@gmail.com on 26 Oct 2013 at 12:05

GoogleCodeExporter commented 9 years ago
Bye for now, I'm going to bed

Original comment by ainselvi...@gmail.com on 26 Oct 2013 at 12:06