PHPmyadmin error on site - php

Without any changes, we suddenly received the following error while wanting to access our mysql dbase via phpmyadmin:
Warning: Unknown: open(/var/lib/php/session/sess_8i4gv03ka359ktq4tp4h81oufs638cig, O_RDWR) failed: Read-only file system (30) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
Does anyone know why this happened & how I can solve ?
thx
bart

Your problem is that your sessions directory is not writable by the web server. This disables your ability to create sessions.
First check that the directory /var/lib/php/session/ exists. If so, check if it's on a writable medium. Because the message Read-only file system makes me a little unsure.
Then make the directory /var/lib/php/session/ and its current contents writable for the web server. Try chowning the directory to the user that runs your web server. Or (easier, but a bit less secure) chmod 777 /var/lib/php/session followed by chmod 666 /var/lib/php/session/*

Related

Why i am i getting this error after installing php

Hey guys i am using a Windows 2016 VPS Server and i installed IIS Web server on it along with php but i am getting this error with sessions.
Warning: session_start(): open(C:\Windows\temp\sess_qbageacapafd73fbj19idjbtd3, O_RDWR) failed: Permission denied (13) in C:\inetpub\wwwroot\system\global.php on line 6
I got the same error when i choose a different session path
Warning: session_start(): open(C:\Windows\PHPSessions\sess_qbageacapafd73fbj19idjbtd3, O_RDWR) failed: No such file or directory (2) in C:\inetpub\wwwroot\system\global.php on line 6
Is there a way to fix this?
You need to update the permissions of the temp folder so the user that IIS runs as has write permissions.
Another option is to change the session folder to a folder that is inside your document root. This is not recommended on public websites for security reasons since it can allow hackers to access your session information.
The best option is to give write permission to the IUSER or whatever user IIS runs under

Permission denied when opening localhost

I had recently installed Apache, PHP and MySQL in Ubuntu. And copied the files I created to the var/www directory. But when I open http://localhost it is showing
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required '/var/www/index.php'
(include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
How can I run my project normally? It was working fine in windows.
According to this article, you need to give read/execute permissions to Owner, Group, and Everyone.
Set permissions on the problem file to 777. Note, you should avoid doing this on a server that's accessible from the internet.
http://webomania.wordpress.com/2007/03/12/permission-denied-in-unknown-on-line-0/
To fix this problem, look at the line in your ErrorLog, to find out which folder it is trying to access.
If a block already exists for that folder, make sure it is set to allow access as necessary. If not, add a block to your Apache configuration file, allowing access as required. See the example below for folder /usr/local/awstats/htdocs.
Order allow,deny
Allow from all
for a complete reference, check the apache wiki

PHP File Uploading Issues

I'm trying to implement script that will allow a file to be uploaded, and then moved to a designated directory. This is running on a Windows server & IIS. I'm having 2 issues in doing so.
First, I get an error when trying to move the file.
Warning: move_uploaded_file(reports/ff.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php1EAB.tmp' to 'reports/ff.jpg' in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29
Stored in: reports/ff.jpg
When searching, almost everything says it's a permission problem. I have added full rights (will pare down later) to the user: IIS_IUSRS. Even did it to the parent directory as one site recommended.
Second: As a possible solution to the above issue, I tried changing the directory in which files are saved. But the files are still uploaded into C:\windows\temp.
I've run phpinfo, and it says that uploads should be in (as defined by upload_tmp_dir):
Again, this is on a Windows Server 2008. Thanks.
Permission denied
You need to set the folder permissions to 777 or enable read write to the folder. I think the permissions are messing...
OK, the answer was simple. I was adding permissions for user: IIS_USRS, when it should have been just user: USRS.

FTP in PHP not copy index.php file

I have a PHP script to copy all files in a directory i have change my server now its not copying index.php file all other files copy successfully and throw bellow warnings.
Warning: ftp_get(tmp/readme.txt): failed to open stream: Permission denied in /var/www/vhosts/Site.com/httpdocs/includes/ftp.class.php on line 123
Warning: ftp_get(): Error opening tmp/readme.txt in /var/www/vhosts/Site.com/httpdocs/includes/ftp.class.php on line 123
Warning: fopen(tmp/readme.txt): failed to open stream: Permission denied in /var/www/vhosts/Site.com/httpdocs/includes/clone.php on line 196
Seems like a permission issue on the new server. Double check the server directory you're accessing to make sure, you and apache have the appropriate permissions.
Like the error message says: Permission denied, in other words your script does not have permission to access the file tmp/readme.txt. Check that the user your PHP script is using has read access to the file/folder. The way to check that depends on what your server setup is so can't give more unless you provide more info about what your server is running.
Welcome to the unix world. It is a permission problem. If you have rights, you can fix it with the command chmod in the server.
$ ssh username#server
$ chmod PERMISSIONS /path/to/filr
check the man page of chmod to understand the permissions. probably you do something like this : +w
It seems this permission issue, not in the new server but in the old server.
Please check owner:group of the index.php file in old server, so that your script can access and manipulate the origin file.
One more thing. Did you run the ftp transfer script, in the browser or in the command line?
This is very important, because one can run the script with APACHE user (www-data) and the other method run the script with your system user.

How to control the file permissions when the netbeans php plugin uploads a file with FTP

Whenever netbeans preforms an ftp upload the files are uploaded with the permissions set to 640. This causes PHP to throw the following error:
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required '/Library/WebServer/Documents/notes/index.php' (include_path='.:/usr/local/php5/lib/php') in Unknown on line 0
While I can clean it up with a quick chmod o+r ./* in the command prompt it causes netbeans to resynchronize the entire project next time I hit run which in turn sets the permissions back to 640.
I need a way to make netbeans upload the files with permissions set to 644.
Make sure the checkbox for "Preserve Remote File Permissions" under Project Properties > Run Configuration is checked, if you want to not change remote file permissions.
I determined that the problem was not with netbeans. It was with ftpd on the server.
The fix was to create a file called ftpd.conf in /etc/ and add the following line:
umask all 022
In your vsftp.conf file, look for this:
# Default umask for local users is 077. You may wish to change this to 022,
local_umask=022
Then, un-comment / adjust as needed.
Just to make a little easier if you are tired like I was. All the other answer where a rabbit hole and didn't work for me.

Categories