PHP code in localhost not working in server - with phantomjs - php

I am using a php script from github to capture screenshot of a website. Its working fine in localhost. But not working after uploading the same code to my server (linux hosting). I tried uploading to multiple servers. None of them worked. No error codes are coming.
In the documentation, it says:
Make the bin executable chmod +x /var/www/html/screen/bin/phantomjs,
Make your folder writable
I am not sure what does that mean, so i set file permissions of whole files and folder to 777. Still not working
How did i upload to my server.
I uploaded the whole code to the server. Changed file permissions of all directories and files to 777 using FileZilla. I have attached a screenshot of
it.

I think it is still permissions issue, You need to set the proper permissions using putty.
1. Login using putty
2. Open root directory
3. Set permissions file and folder using this command
===> chmod -R 777 folder name

Related

How to enable writing to sshfs directory in PHP

I have in my home directory a SSHFS directory mounted to a remote directory on other server. I currently run PHP under my username (not root). The problem is, I cannot verify if a folder exists on the remote machine or even write a file.
When I try this over console it works, I mounted the directory with the same user and chowned by the same user. When I try to copy a file from script or check if a directory exists it does not work.
When I'm trying it over putty and logged in as the same user, nginx and php runs it works?
solved it
i had to add -o allow_other to the mount point in case someone is facing the same problem

LAMP on Ubuntu creates write protected files

I have set up a Ubuntu LAMP server, and everything is working fine, however, I have a PHP script that allows the user to upload files to a directory within the www directory. The files saved via PHP are chmod 644.
How can I change the setting so that the files saved on the server are chmod 755 by default?
Educate yourself as to what a umask is.
Use the umask() function.

php apache error message - access forbidden

when I 7zip a folder with php files on a PC and send it to my Mac, I can extract everything properly etc. But as soon as I turn on the localhost and want to open them in my browser, I get
"You don't have permission to access the requested object"
Even if I change permissions to read, write and execute for everyone, I cannot access the files in my browser.
What do I need to do?
Thanks
Dennis
Maybe in your Apache HTTPD config file/.htaccess there is a restriction.
Also, look the chmod of your file, even if the directory is chmod'ed 777.
Try testing on a new hello world php script in your project directory, you will see if you can execute it.
Make sure that the apache can read the files. For testing porpose you could run chmod 644 filename and also chmod 755 dirname.
If you played with the server configuration make sure that the server configuration allows the clients access to that path.

Search a file on a linux server with a php

I´am with a problem for search a file on a linux server, i try to read a directory but i can´t set permission for the script on php read that directory.
The problem is not the permission by himself, because i set chmod -R 777 [file] and this don´t work, for make the problem worse that directory is a link to another directory so i don´t know if the problem is the origin or the destination.
PHP and Apache must be in a group that has access to that directory.

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