Failed to open dir on server - javascript

In localhost I can delete, copy my folder and files just fine. However, after I host my web app, those functions don't work on the server.
Here is the error that I got:
Uncaught exception 'UnexpectedValueException'
with message 'RecursiveDirectoryIterator
::__construct(/home/solution/public_html/portalprojectcdr/backend/web/The Library/ISU/New directory) : failed to open dir: No such file or
directory' in /home/solution/public_html/portal/backend/views/site
/submit_upload_to_server.php:73

As there seems to be a new directory involved in your error, i suppose you should check permission and owners for your files.
Please mass downvote if this advice in unsecure, but i use it on production :
Define the user www-data as owner of the file and folder that must be writable.
If you are not on production, you can try a naughty chmod 777 where needed, to see if your problem is really permission related.
Don't forget to put permission back to normal after your test.

Related

Can't open VSCode with other user

Well basically i created another user, and i'm tring to open a node project, but i can't use "code ." (i think it's because vscode is installed in the other user, but idk) without having the following error:
~/amq-javascript-2.5.0/node_modules/rhea$ code .
2020/02/12 10:02:20.859002 cmd_run.go:884: WARNING: cannot create user data directory: cannot create "/home/amq-broker/snap/code/24": mkdir /home/amq-broker/snap: permission denied
cannot create user data directory: /home/amq-broker/snap/code/24: Permission denied
I already tryed with sudo, and got this:
~/amq-javascript-2.5.0/node_modules/rhea$ sudo code .
You are trying to start vscode as a super user which is not recommended. If you really want to, you must specify an alternate user data directory using the --user-data-dir argument.
I'm kinda lost here...
I had the same issue. I was able to finally get it to work by running ...
sudo code . --user-data-dir='.'
OR
sudo code --user-data-dir /home/fregie/.config/Code/ doesn't work because it needs to be a new user data directory, one whose permissions are not as restrictive as ~/.config.
This should work for example:
sudo code --user-data-dir /home/fregie/.code-root-user-data
Note that once we reshuffle the configuration directories this will no longer be necessary to explicitly indicate the root user data dir

'/javascript' named directory does not get access to my localhost. Why?

I am having a Ubuntu 16.04 and it is running Apache 2.4.18. So when I created a directory named "javascript" in my directory /var/www/html.
Then I also created a html file. And when I tried to run it on my localhost as show below:
localhost/javascript/
It is showing error as show below:
"You don't have permission to access /javascript/ on this server."
And when I created same html file in but in another directory named "learn_js" it is not showing any error. Why ???
Modify the host config file of your Apache server. Add the following:
Order allow,deny
Allow from all
If that doesn't work, simply change the permissions for the /javascript/ folder.
chmod 755 /javascript/
Solution might be:
sudo a2disconf javascript-common.conf
This package redirects Alias /javascript /usr/share/javascript/. Isn't that an ill-manered thing to do by default?
Thanks to #uKolka for finding this.

Node JS express-generator

I am using Ubuntu and learning Node JS. I was trying to use the express-generator that sets up a template for all the files you need to build a website. However, it locked all the folders and I can't save anything. Is this something where I have to go in and chmod every file and directory individually? Is there a better faster way? Does this happen in Windows and Mac as well?
set the read/write permission to that directory or file recursively
sudo chmod 777 /your_project_path/
sudo chmod -R 777 /your_project_path/
once you set the permision then install the component in that folder
Update
755 – This set of permission is commonly used in web server. The owner has all the permissions to read, write and execute. Everyone else can only read and execute, but cannot make changes to the file.
777 – Everyone can read write and execute. In a web server, it is not advisable to set ‘777’ permission for your files and folders as it allows anyone to add malicious code to your server. However, in some cases, you will need to set the 777 permissions before you can upload any file to the server (For example, uploading images in WordPress)
644 – Only the owner can read and write. Everyone else can only read. No one can execute the file.
655 – Only the owner can read and write, but not execute the file. Everyone else can read and execute, but cannot modify the file.

Forbidden : You don't have permission to access /questions.php on this server

I am beginner in PHP and I got the Error for Developed My Project ERROR is Like:
This: Forbidden
You don't have permission to access /quiz.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Please give the suggestion for Solve this problem.
From interpreting the error, I believe that the problem doesn't lie in php but rather in the underlying operating system and filesystem. More specifically, file permissions.
If you are running Apache on Linux the webserver will only be able to serve pages that it can read. This has to do with local filesystem permissions.
I'm taking a leap here, but if your server is run by the user www-data then that user needs read permissions to the .php files in order to serve them as web pages. If these files are in a subdirectory, then that subdirectory and the .php files inside must also be accessible by www-data.
First, make sure that quiz.php is readable by the user www-data, as most likely you would have created this file using a different user account (root? yourself?).
The following command sets the owner of the file quiz.php to www-data
chown www-data quiz.php
This command needs to be issued in the directory where quiz.php is located and it needs to be entered with a user account that has sufficient privileges to change a file's attributes. Normally this is the root account, but it could be you if the server's administrator has given you those permissions.
You can read up on the chown command by typing
man chown
on most Linux systems.

Cannot GET /foldername

I am trying to access following url in my browser, but it throw error "can not get/foldername"
http://lineup.fezzee.com:8080/json/
Although when i access file in this folder, it works
I have given 777 folder permission
What i want is that when I hit http://lineup.fezzee.com:8080/json/ it will display all files in browser
I am using Ubuntu server
Thanks in advance

Categories