Image directory is working on localhost but not in webserver - php

I have photo upload on my site and it is working well when I was testing it on localhost. This is how and where the photo I uploaded on my localhost:
if($_FILES['file']['error'][$key] == 0 &&
move_uploaded_file($_FILES['file']['tmp_name'][$key],
"../gallery/{$gallery_images}"
)
){
....
}
But when I tried this on a webserver, it started showing errors. These are the errors:
Warning: move_uploaded_file(../gallery/289228065.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(): Unable to move '/tmp/php3hJjHL' to '../gallery/289228065.jpg' in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(../gallery/2001593678.jpg): failed to open stream: Permission denied in /var/www/alumni/admin/create_album.php on line 51
Warning: move_uploaded_file(): Unable to move '/tmp/phpDiNyPg' to '../gallery/2001593678.jpg' in /var/www/alumni/admin/create_album.php on line 51
What should I do? I tried change the path but the same errors show up.

Related

"move_uploaded_file (/var/www/html/crm/upload/36379.jpg): failed to open stream: Permission denied"

When a user uploads a file and I want to move it from temp directory to upload directory, I got this error message in the browser:
Warning: move_uploaded_file(/var/www/html/crm/upload/36379.jpg): failed to open stream: Permission denied in /var/www/html/crm/register_free_adviser.php on line 373
Warning: move_uploaded_file(): Unable to move '/tmp/phpeXf3DM' to '/var/www/html/crm/upload/36379.jpg' in /var/www/html/crm/register_free_adviser.php on line 373
bool(false)
OS: centOS 7
the project works fine on my system which runs windows,XAMPP,apache. but on my server which runs centOS I have issues.
I tried this solution but the problem didn't get solved.

PHP file_put_contents failed to open stream

So the PHP program is supposed to take the user input and save it in a text file called "guest_list" but I am getting these error messages:
Warning: file_put_contents(guest_list.txt): failed to open stream:
Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/lecture2/welcome.php on line 44
Warning: file_put_contents(guest_list.txt): failed to open stream:
Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/lecture2/welcome.php on line 45
Warning: file_put_contents(guest_list.txt): failed to open stream:
Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/lecture2/welcome.php on line 46
Warning: file_put_contents(guest_list.txt): failed to open stream:
Permission denied in /Applications/XAMPP/xamppfiles/htdocs/lecture2/welcome.php on line 47
Any help would be greatly appreciated.

Error messages for uploading files

I keep getting these error messages when using a plug in "üsers ultra pro":
Warning: mkdir(): No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 227
Warning: move_uploaded_file(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: move_uploaded_file(): Unable to move '/tmp/phpTloN3B' to '/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg' in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: getimagesize(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 234
I have checked all the permissions are set to 755 but it still won't work. Any ideas? Thanks :)
Background: I am running a multi user site on Wordpress (think pinterest) where users will be able to upload images/text.

Magento URl error with PHP

I installed fresh magento 1.9.2.2. While installing and after it instaled, whenever i try my domain url the same error have been coming like shown below.
Warning: include_once(Mage/Core/functions.php): failed to open stream: No such file or directory in /home/website/public_html/app/Mage.php on line 50
Warning: include_once(): Failed opening 'Mage/Core/functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/website/php') in /home/website/public_html/app/Mage.php on line 50
Warning: include_once(Varien/Autoload.php): failed to open stream: No such file or directory in /home/website/public_html/app/Mage.php on line 51
Warning: include_once(): Failed opening 'Varien/Autoload.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/website/php') in /home/website/public_html/app/Mage.php on line 51
Fatal error: Class 'Varien_Autoload' not found in /home/website/public_html/app/Mage.php on line 54
So I used
http://xxx.xxx.xxx.xxx [my ip address]/~website/
then in installtion I changed my path to my domain name. Its not working.
Anyone know any solution. Please help me.
I think that your problem caused by the .htaccess file. Try to rename it to test this idea or check rewrite/redirect rules.

pChart - running scripts as www-data doesn't work

So I'm having trouble running PHP scripts for pChart. Running them as the user who created them works fine, but if I sudo to www-data, I get these errors:
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d
/mcrypt.ini on line 1 in Unknown on line 0
PHP Warning: include(/usr/lib/pchart/class/pDraw.class.php): failed to open stream: Permission denied in /usr/share/phpmyadmin/test.php on line 4
PHP Warning: include(): Failed opening '/usr/lib/pchart/class/pDraw.class.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/phpmyadmin/test.php on line 4
PHP Warning: include(/usr/lib/pchart/class/pImage.class.php): failed to open stream: Permission denied in /usr/share/phpmyadmin/test.php on line 5
PHP Warning: include(): Failed opening '/usr/lib/pchart/class/pImage.class.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/phpmyadmin/test.php on line 5
PHP Warning: include(/usr/lib/pchart/class/pData.class.php): failed to open stream: Permission denied in /usr/share/phpmyadmin/test.php on line 6
PHP Warning: include(): Failed opening '/usr/lib/pchart/class/pData.class.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/phpmyadmin/test.php on line 6
PHP Fatal error: Class 'pData' not found in /usr/share/phpmyadmin/test.php on line 10
Does anyone have any idea what permissions or groups I'd need to change to get this working? I've tried changing everything mentioned in the output above to 777 but it's still happening.
Ok, it was permissions, though it's not clear which ones yet. It started working when I changed the pChart2.1.3 folder permissions to 777. Now I can tidy up.

Categories