I am able to access my localhost as well as phpmyadmin for wamp server but I have really struggled to access my folders in wamp servers www folder. Any time i try i get the following error
**Forbidden**
You dont have permission to access /folder/folder on this server.
I imported the files I am trying to run locally from my host and they are written in codeignitor.
Related
I have been searching for hours now and I cant find a solution. I have tried much to many things to even start listing the things. So please any assistance would be appreciated.
I have changed the htdocs folder location in httpd.conf because I have all my files sync to cloud storage. This works perfectly on my windows machine but on linux not so much. Every thing runs perfectly but when I try to access my htdocs folder (new location) I get a message:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.48 (Unix) OpenSSL/1.1.1k PHP/8.0.10 mod_perl/2.0.11 Perl/v5.32.1
But When I change the location back to the normal location it works perfectly.
I have already gave full access to the folder.
Think of a directory structure as a series of security doors:
/var
/www
/htdocs
If you give someone a key to htdocs (i.e. set the permissions to give a user access) then they can open that door… but only if they can get to it.
If you don't also give them keys to www and var then they can't get into htdocs.
My website runs correctly on xampp server, but I tried the Windows PHP localhost server (IIS), but for unknow, reason mysite.php run but can not show the CSS or the image that are on subfolders
I tried to give full access permission but with not help, and I have no idea what else can I do to make my PHP website able to access the subfolder that contains CSS/images/and txt files.
I have developed a MVC project with Laravel 5.4. Whenever I want to develop it on localhost, I use php artisan serve command to access it via localhost:8000 on browser. Now I have uploaded the project on a linux server with centos 6 and I run php artisan serve --host 0.0.0.0 --port 8080 to access it via x.x.x.x:8080 on browser but it is a temporary way to access project from browser. What is the permanent way to access a laravel project by clients via public IP?
I have apache,php and ... separately installed on my server. I can not see x.x.x.x/projectname/public or x.x.x.x/projectname. The project is in /var/www/html directory.
You can access the laravel project with yoursite.com/projectname/public if you upload your project on web root.
If you want to access it directly with yoursite.com you need to map the public folder in your virtual host configuration.
# The location of our projects public directory.
DocumentRoot /path/to/your/public
On your linux server install the LAMP or XAMP that include the apache server and Mysql and some other related tools into it. Upload the code on web root. Now try to access it with the IP or the domain name like:
XXX.XXX.XXX.XXX/projectname/public
or
or domain/projectname/public
Note: You can remove that public by making a symlink to the public directory or by making a virtual host entry.
Here are the steps you need to do [assuming you are using apache, but its not very different for nginx]:
install PHP, MySQL and apache in your server
place your project in /var/www/ folder
give permission to storage folder of your project chmod -R 777 your/project/storage
edit /etc/apache2/sites-available/000-default.conf file e.g. DocumentRoot /path/to/your/public
restart apache
Please check other answers. They are very good and give you a clear starting point. Just do little research and you will get it.
Created an application using Codeginiter and is working fine with my local environment which is in XAMPP.
After uploading application folders and files to linux server application is not working at all.
Deployed complete files under "/var/www/html/" and when access from browser it gives me CI error as "404 Page Not Found".
After uploading, I have updated .htaccess file.
I think this is about Linux file permission. You might want to check its file permission.
try to change the permission to read, write and executed by you ONLY example:
sudo chmod 700 var/www/html
We develop our PHP-based web applications by editing our working files in a shared, local directory on each of our windows machines. The (linux) staging server then mounts our shared drives and serves them each under subdomains. E.g. joe.work.com would serve Joe's working directory. We then access our own staging sites by editing our hosts file to point the subdomain to the staging server...and all of that works great!
We're now running into the issue that PHP doesn't seem to have permission to move uploaded files from the tmp directory to a directory inside of the mounted directory (which is actually the shared windows drive...?).
The working directory on the windows machines are set to allow everyone rw, and I have tried putting 777 on the mounted directory in the staging machine, but I am still get permission denied.
The shared drive, say, \\joes_machine\joes_working_dir mounts on the staging server to /var/mnt/joe. The file upload needs to be moved to /images/common.
Albeit slightly dumbed down for this example, I'm not doing anything fancy code-wise:
$working_directory = '/var/mnt/joe';
$image_directory = '/images/common/';
$full_filename = $working_directory . $image_directory . $filename;
if(move_uploaded_file($_FILES['photo']['tmp_name'], $full_filename))
// do some other stuff
My error of course is:
Message: move_uploaded_file(/var/mnt/joe/images/common/resulting_filename.jpg):
failed to open stream: Permission denied
Message: move_uploaded_file(): Unable to move '/tmp/phpjsEfBc' to
'/var/mnt/joe/images/common/resulting_filename.jpg'
What am I not understanding about file permissions pertaining to a windows shared drive being mounted over the network by linux and PHP needing to write to it? I can't seem to find the hang up!
Once we hit production, we won't be using the schema, but if there's a simple solution to be able to continue in our current development environment, then that would be ideal!
After a few hours of facerolling, I finally found what I was missing. The issue was that the credentials supplied couldn't write to the mounted directory as expected. The way I was able to fix this was by editing the mount command as follows:
mount -t cifs //shared/directory /mount/target
-o rw,username=connectionuser,password=password,uid=48
so, username and password are to be the windows credentials used to connect to the drive, but uid specifies the unique identifier of the local user on the staging server that apache runs as so that it may write to the mounted directory.
previously, i had not specified the uid of the local user, so when apache was trying to write to the mounted directory, it was trying to use the windows credentials (that couldn't write on the 'local' drive)
hope this is helpful!