PHP pages getting 404 in public_html - php

I have a couple of PHP-based projects (that are working fine locally), but I'm looking to host on the same server as my Wordpress site/portfolio.
I have put those folders in public_html folder in my file structure but they are generating a 404 error when I try to load them.
HTML based pages work fine, for PHP it's not. Does anyone have any ideas?
I'm sure I'm missing something fairly obvious but am at a loss at the moment...

You need to change the permission of files. Either change it via command line,
find foldername -type d -exec chmod 755 {} \;
find foldername -type f -exec chmod 644 {} \;
Or change it via cPanel,
Change permission for files to 644 and folders to 755

Related

Cannot update Wordpress theme and plugins (file permission issues) in linux server

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.
When trying to update plugins from the admin interface. I’ve set the user to www-data for both directories and files … but nothing works.
What do I have to do to simply being able to use Wordpress as it is intended?
This issue is usually caused by incorrect file permissions or ownerships on your server (rather than being a problem with the plugin itself). Basically, WordPress isn’t able to properly access its own plugins folder, and as a result, can’t put the updated plugins files in there.
Permissions
Permissions can be set to 644 for files and 755 for folders. To do so, you can run two quick find commands.
To make all folders in your website path with 755 permissions run the following command
find /path/to/your_website -type d -exec chmod 755 {} \;
To make all files in your website root directory with 644 permissions, you can run
find /path/to/your_website -type f -exec chmod 644 {} \;
Please make sure to change /path/to/your_website with your real path.
Ownership
Ownership means which user and group are controlling the files. Usually, that’s www-data. So what you’ll need to do si
sudo chown -R www-data:www-data /path/to/your_website
Please make sure to change /path/to/your_website with your real path.
Once you do it, that’s it, you are good to go.

Permissions issues when uploading plugins from Wordpress locally

I'm trying to work on Wordpress locally via localhost with Xampp. The issue comes when I try to download plugins.
It says:
Installation failed: Could not create directory.
I'm guessing it's permissions issue. I tried many things like
chmod 777 /opt/lampp/htdocs/wordpress/wp-content/plugins
chown -R www-data:www-data /opt/lampp/htdocs/wordpress/wp-content/plugins
I'm quite new to Ubuntu so I tried a bunch of things similar to the above to try and find the directory that needed permissions
**Solution
It worked for me -->
find /opt/lampp/htdocs/wordpress -type d -exec chmod 777 {} \;

How to change permissions of Wordpress and/or apache on macOS securely?

I have encountered a problem when trying to add an image to WordPress:
"Unable to create directory wp-content/uploads/2017/05. Is its parent directory writable by the server?".
Thing is that I installed WordPress locally, without MAMP. Root for Apache is /Library/WebServer, port is 80.
Already tried adding define( 'UPLOADS', 'wp-content/uploads' ); to wp-config.php, but it didn't work. According to this, I assume that problems are with permissions of WordPress to /Library/WebServer.
Anyone knows how to change this permissions securely?
Use command line tools.
Run the following commands to change the permission of the wordpress folder.
find yourwordpressfolder -type d -exec chmod 755 {} \;
find yourwordpressfolder -type f -exec chmod 644 {} \;
On mac you can find terminal which is used as command line tool.

WordPress not loading CSS or JS

Hi i am working on my client site I cannot figure out why resources like css/js/images are not loading. neither on the main site nor on the backend. I have replaced with new WP core files but still I cannot figure out the problem. here is the site: http://old.allsaintsnorthepping.org.au/
if you check the console it will say 404 not found
If you have a command line , then you need to change/set the permissions of the all the wordpress files and re-upload them to the server.
Run the following commands through terminal to change files and folders permission.
find folder_name -type d -exec chmod 755 {} \;
find folder_name -type f -exec chmod 644 {} \;
Replace folder_name with your wordpress folder.

Laravel 5.1 on ubuntu 14.04 Problems with session

I've got the following problem with laravel (5.1) sessions on ubuntu 14.04. On every request a new session file in storage/framework/sessions is generated. As you have already guessed, the session driver is 'file', 'lifetime' is set to 120. This seems to be some sort of permission error. I've set the permission of the storage folder to 755 (also 777), but every newly generated session file has the permission 664 (rw- rw- r--). Via google I've only found a session issue related to dd(...), but this is not the case here, especially that it works fine on a windows environment.
What I originally wanted to do is use the redirect()->intended(), which uses the information stored in the session.
Do I have to run php artisan serve in a special way?
Since I use Vagrant and Homestead everything is fine. Running the PHP built in webserver seems the be a kludge only.
Test the funcionality giving all the permissions to the storage folder
find /path/to/storage/folder -type d -exec chmod 777 {} \;
If it works then set the propper permissions that in most of the cases should be
find /path/to/storage/folder -type d -exec chmod 775 {} \;
That way you only change the permissions to the directories not the files.
If the problem it's the newly created are being set with different owner you could set the permission for it.
It's like when I'm developing on my local server I have my user and the www-data user it's the one for Apache, so if apache creates a new file the ownership starts to mess up.
find /path/to/root/of/project -type d -exec chmod g+s {} \;

Categories