localhost/phpinfo.php - php

I have installed php oauth extension in ubuntu 110.10.
But on http://localhost/phpinfo.php in google chrome it is giving the following error:
Server error
The website encountered an error while retrieving http://localhost/phpinfo.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
This means i am giving link to localhost then getting this error.
And in mozilla it is giving a blank screen.
It is not providing any information about installtion in php
How do i resolve this problem?

It may be permission error.. Please check your folder permissions. Bcz, Most of Ubuntu (linux) users can face this type of error.
by the author of question:
sudo chmod 0777 -R /var/www/phpinfo.php

I had a similar problem but the reason was because I had just restored my files into www from a Windows NTFS backup drive.
Naturally, with NTFS we don't have the same permissions of Ubuntu or any other Linux system.
Looking at the folders using nautilus showed incorrect owners and permissions.
How I fixed it...
Took ownership of my /var/www folder and its contents by doing this: chown khalid -R /var/www
Changed the mode of the www containing files like this: sudo chmod 644 -R /var/www
If you still get errors, do this: gksudo nautilus. Then go into your /var/www folder and change the permissions to allow owner/group read/write and check the box to execute as program. Also apply this to the sub-folders.
NOTE: Never give 777 permissions to a web folder/file. That's like keeping your front door key hanging in the front of your gate! However, if this is a machine that never sees the daylight of Internet, it shouldn't be an issue.

Related

Wordpress The uploaded file could not be moved to wp-content/uploads

So I have a pretty standard Wordpress site setup, however when trying to upload a photo I get an error saying
The uploaded file could not be moved to wp-content/uploads.
I'm running nginx and the user is nginx, I have the user and group of the directory set to nginx.
the directory and all sub-directories is set to 755, and still this error comes up, so i changed the directory permission to 777 to test and still the error pops up.
Obviously this is bad practice and should never be used but i was curious if maybe the user was wrong. I'm running CentOS 6.7
Just for notes the directory is /usr/share/nginx/site/wordpress/wp-content/uploads
please don't comment saying anything about changing the directory to 777.
Its kind of old question but I think it might be helpful for some one like me. I had same issue and I solved it by running following commands from terminal, please note your path of html may differ from mine. You need to figure this out.
sudo chown -R www-data:www-data /var/www/html
and after it
sudo chmod -R 774 /var/www/html
It's complaining that the user nginx does not have the permission to move the image file. Try changing the permissions of the image file(s), or changing the owner of these files to nginx.
=> php-fpm needs write access, not nginx. php-fpm process running as uid 1000, not as www-data/apache.
so you could change group like this:
chgrp -R 1000 /usr/share/nginx/site/wordpress/wp-content/uploads
ideally you would limit what directory www-data/apache and php-fpm have write access to, Likewise limit it to an upload directory for example in WordPress.

The uploaded file could not be moved to wp-content/uploads/2015/01. issue on image upload

I am working on a WordPress website from 2 months and I have uploaded many images before but I am getting an error when uploading image and I am facing this issue after new year :- The uploaded file could not be moved to wp-content/uploads/2015/01.
there is Screenshot below:-
This article explains and resolves the issue very well: http://2surge.com/how-to-fix-the-uploaded-file-could-not-be-moved-to-wp-content-error-message
The basic premise is that the identity of the process running your httpd / apache / web server thread must have write access to your upload directory.
To resolve the issue:
Check which account your webserver is running under
Update: On Unix use...
ps aux | egrep '(apache|httpd)'
... this will show a list of processes for the web server along with the identity of the process under which its running e.g."nobody"
nobody 8718 0.1 0.4 1332864 17180 ? Sl 17:11 0:06 /usr/local/apache/bin/httpd -k start -DSSL
Update the permission of the upload directory to allow that account to write to it.
Update: On Unix, you can use...
chown -R nobody /<path to upload directory>/wp-content/upload/
You can also amend permissions for this account (at the rquired location) to ensure it has write permissions using chmod or filezilla and cascade the changes to the directories as necessary.
Check out the linked article for a detailed breakdown. Hope that helps! :)
This works for me.
$ sudo chown -R _www uploads/
$ sudo chmod -R g+w uploads/
I am assuming you are in the wp-content directory.
You just need to give permission to PHP to write in the uploads folder, this worked for me:
sudo chown -R www-data <path>/wp-content/uploads
I have searched and found that the problem is from server provider.
Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).
Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account). For example, you may have a user account that lets you FTP files back and forth to your server, but your server itself may run using a separate user, in a separate usergroup, such as dhapache or nobody. If WordPress is running as the FTP account, that account needs to have write access, i.e., be the owner of the files, or belong to a group that has write access. In the latter case, that would mean permissions are set more permissively than default (for example, 775 rather than 755 for folders, and 664 instead of 644).
You can see here how to change file permission..
If you're using something with SELinux (like Fedora or CentOS), you'll also need to set SELinux permissions. Assuming that your directory is called uploads (for example)
chcon -R -t httpd_sys_rw_content_t uploads
This will set uploads and everything under it to be uploadable to the web server user
it probably doesn't have the permissions to create
/uploads/2015
Check if that folder exists, if it does, then check
if /uploads/2015/1/ exists.
permissions:
chmod 755 /uploads/2015/1/
chown www-data:www-data /uploads/2015/1/
These folders should have the same permissions as the /uploads/ folder.
Also check the error_log, because it should show you exactly what folder is causing the issue.
This works for me
sudo chown -R www-data html
Assuming current directory is www
Ubuntu 16.04, Apache2
I had this problem as well and found out it was because the hosting account's disk quota was exceeded.
I found that there was an old script that was logging errors and the error log had gotten so big it filled the available quota.
I finally figured it out when I attempted to create a new directory using FTP and the server response was "Disk quota exceeded."
I got this error on a cPanel hosting account, where the disk quota (for the account) was not an issue. After delving into it for a while, I found that cPanel's "Select PHP Version" tool was set to v7.1 but multiple WordPress diagnosis tools were detecting v5.6 was actually running, and they also detected file system issues.
The File Manager tool in cPanel showed all the permissions were correct, and the folders were writeable.
One of the diagnosis tools I used was part of the Wordfence plugin. It was available on the Dashboard menu at Wordfence > Tools > Diagnostics (tab).
I reported the issue to the hosting company, and it appeared to fix itself overnight (the person who responded to my support ticket indicated they didn't fix anything). I think it's likely it was a symptom of a problem that affected multiple hosting accounts, and somebody else within the hosting company probably detected it and fixed it.
In case others encounter a similar issue, I hope this answer helps them spend less time trying to track it down. Once I discovered the incorrect PHP version appeared to be running, I figured it was probably not something I could fix with only cPanel access.
This will happen when you migrate a WP site to a different server.
Problem is the ownership.
Run this in a terminal:
chown -R <site-user-name> /home/<site-directory>/public_html
z
There are multiple reason because of this such error arise.
Main problem is folder permission.
wp-content/upload/
Folder permission must be 775 or 664.
Other solution if the error not get resolved try below
Go to Cpanel and your website folder or by using FTP.
Then you will get wp-config.php {This file available on root folder}
In that do below change
Open the wp-config.php file and add the following code:
define( 'UPLOADS', 'wp-content/uploads' );
before below line
require_once(ABSPATH . 'wp-settings.php');
I hope this will help. It's help me on Plesk Hosting.
This solution is only for those who use the cPanel control panel, and you must test this for other panels like aaPanel, Directadmin and others ...
Be sure to take a snapshot/checkpoint from your server before making changes.
Install the mod_suphp module through Easy Apache.
After installation from the MultiPHP Manager section:
Select suphp from the drop-down menu under the PHP Handler column
And finally, apply the changes.
Test again and if necessary type the following commands:
/usr/local/cpanel/bin/rebuild_phpconf –current
Open you xampp
Click on explore
Double click on folder of your project
Click on "Get Info" in options list
Unlock the locker in the right bottom side by entering your password
Then change permissions to read and write
MOST IMPORTANT POINT, remember to click on the bottom left conner dropdown and select Apply to all
There it will work.
Watch how it is done in this video
Thank me later How to fix xampp permission problem on mac
Changing directory permission to 777 helped me.

How to fix error "Fatal error: Uncaught --> Smarty: unable to write file"?

I migrated Prestashop from localhost to website domain using digitalocean, but when I open this website I get this error
Fatal error: Uncaught --> Smarty: unable to write file /var/www/html/prestashop/cache/smarty/compile/a4/36/f1/wrt549a35e49b3b44_77591243 <-- thrown in /var/www/html/prestashop/tools/smarty/sysplugins/smarty_internal_write_file.php on line 46.
I tried to change permissions on the smarty folder to 755, but it didn't work. I don't know how to fix it.
You problem is definitely about permissions. It depends on how Apache and PHP are set up.
First, check who owns the folders. For example, simple apache2 and php installation runs as www-data user. For example, if you connected to FTP with 'user1' and uploaded your files there, then the files are owned by you. The group is probably also set to 'user1'.
Therefore, you can modify, write the files, but PHP processes cannot, because they dont own the files (PHP runs as www-data, for example).
Your best bet is to contact server administrator and ask him to help you out.
Rememeber: never set 777 for any files/folders on a website, solve the problem the correct way.
Set www-data permission to access fpm.sock
sudo chown -R www-data:www-data /var/www/*
For Prestashop installation delete the content of the following folders: cache/smarty/compile, cache/smarty/cache, img/tmp;
Delete all the files in the folders, except index.php files.
If this is not working chmod directory to 775

symfony2 cache/log permission issues

I've just uploaded a simple symfony2 app on a production server, and I get this configuration error:
2 MAJOR PROBLEMS
Change the permissions of the "app/cache/" directory so that the web server can write into it.
Change the permissions of the "app/logs/" directory so that the web server can write into it.
editing "app/console", "web/app.php" and "web/app_dev.php" with: umask(0000) doesn't work, and if I right click on that folders with FileZIlla, their permissions are already 777. And so?
thanks...
You need to recursively set the permissions, most likely. I'm guessing FileZilla has that option, if not, ssh into the box, and run (replacing /path/to with the actual path)
sudo chmod 777 -R /path/to/app/cache
sudo chmod 777 -R /path/to/app/logs
Sidenote: setting the permissions to 777 is usually a really bad idea.
umask(0000) doesn't actually increase the permissions available to the script. It just ensures that files & directories created by those scripts are accessible from both the command line and the web server. If you're not using the command line, you probably don't need it at all.

PHP/Apache: Permission settings for uploaded JPEG image files not correct

I just setup a LAMP development server and am still trouble-shooting some things. The server is installed on one computer and I use a Windows laptop to write my code and test the site via the web browser.
My file uploading script works in that JPEG image files are successfully uploaded to the server, but when I try to view the images in the web browser, permission is denied.
I check the permissions on the file via the server and they are 600. I can fix the issue by chmod 777 theimage.jpg, but this doesn't seem like a good solution at all.
Does the solution have something to do with Apache configuration? Or is there something else I should be doing.
Thank-you,
Mike
Update
To clarify, I am able to upload a JPEG file to /var/www/test/images, but am unable to view the image in the web browser after it has been uploaded. My script works on the production server (I am using Dreamhost). This leads me to believe that the issue is with the development server that I have just setup. Any feedback is greatly appreciated, even if it is just resources that I should read for better understanding the server setup.
You need to change the permissions on the folder containing the file, not just the file itself. Use sudo chmod and sudo chown on the directory that contains the file you want to access, then check to make sure the permissions where changed with the ls -rl command. The permissions used with chmod should be r and w and the directory should read -rw-r--r-- when the ls -rl command is used if the permissions have been changed correctly. Also, if you are still unclear about the specifics of how chmod and chown work check out this link and this link.
EDIT:
Type this:
sudo chmod -R 666 /var/www/test/images
Or this:
sudo chmod a=rw /var/www/test/images
... to do what you want to do. For more explanation see my latest comment entry below.
I'd say you probably are running PHP under a different uid than Apache.
You can:
Configure apache/PHP so that they run under the same uid
Upon file upload, use PHP tochange the permissions with the chmod function or change the umask associated with the PHP process so that the file gets the correct permissions in the first place
Access the images through PHP (readfile) -- not recommended for performance issues

Categories