I'm trying to install PHP LDAP Admin, http://phpldapadmin.sourceforge.net , on a RHEL 6 server. I have the files in place and Apache virtual host directive configured to htdocs.
The error I'm getting is:
Notice: Undefined variable: _SESSION in /path/to/pla/lib/page.php on line 381 Fatal error:
Call to a member function getValue() on a non-object in /path/to/pla/lib/page.php on line 381
PHP (5.4.13) is running on the server, and sessions are not a problem elsewhere. I cloned my git repository to an OSX development box and it works there. I double checked and session_start() is called.
If httpd is running under apache group:
chgrp apache /etc/phpldapadmin/config.php
I had the same problem and finally i solved it just placing config.php
in the correct folder (phpldapadmin/config)...really silly mistake
I had the same problem (ubuntu 14.04).
I changed the permissions on usr/share/phpldapadmin/config.php and that solved the problem.
This has already been answered by harveyzh but this answer is for linux-noobs like me :)
Happens in most cases after update
and apache (or php5-fpm!) didn't run with default users.
Just add the user wich is running Apache2 (or php5-fpm!) to the system group "www-data" (debian) and restart services apache AND if used php5-fpm both.
Get the User apache is running as:
~# sed -rn 's/^User (.+)/\1/p' /etc/apache2/apache2.conf
Remember:
Changing permissions to repo maintained files is a bad idea.
This takes effect only until the next update fixes them back to default...
I had also same problem where we have just changed the group name for phpldapadmin config.php file. It worked for me.
chgrp apache /etc/phpldapadmin/config.php
Use chgrp GNU command with the group name of apache2
In my case was: www-data
So you need to do like that:
chgrp www-data /etc/phpldapadmin/config.php
to find group name of config.php you should use ls -l command line and take the fourth column
Related
I am trying to run R code from within PHP. I am using RHEL 7.4.
However, because Apache runs as a different user than installed the R packages, it cannot load packages:
My PHP code has this line:
echo shell_exec("(Rscript -e 'library(lme4, lib.loc = \"/var/www/R/lib\")')2>&1");
which produces this error in the browser:
Error: package or namespace load failed for 'lme4' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/var/www/R/lib/Rcpp/libs/Rcpp.so':
/var/www/R/lib/Rcpp/libs/Rcpp.so: failed to map segment from shared object: Permission denied
Execution halted
The file /var/www/R/lib/Rcpp/libs/Rcpp.so has permissions 775, so I don't think the permissions are actually the problem.
How can I tell Apache / PHP where to look for the shared libraries?
The server is not public-facing, so I would take any solution from properly accessing the shared library, to giving user apache sudo access with NOPASSWD to run as my user (or something similarly reckless, since that didn't actually work...).
Thank you!
This appears due in part to an SELinux setting in Red Hat. I'm not entirely sure whether this is Red Hat-centric, or specific to the configuration at my university (who installed Red Hat in the first place).
Originally:
$ getenforce
Enforcing
Fix:
$ sudo setenforce 0
$ getenforce
Permissive
Persistent fix: modify /etc/selinux/config to have the line
SELINUX=Permissive
Credit to this StackOverflow thread.
I'm working on Laravel 5 and I'm using PHP function php -S localhost:8888 folder-name - t to show the web site.
Everything is working fine until I updated to Window 10. Now, I try to run the project in my browser, I get a blank page and this message in my cmd:
[Mon Aug 03 00:17:05 2015] PHP Fatal error: Unknown: Failed opening
required 'public' (include_path='.;C:\php\pear\') in Unknown on line 0
What is going wrong?
It sounds like a permissions issue. I don't have much experiencing working with Laravel on Windows, but I just fixed a similar issue on an Ubuntu box.
The source of trouble for me was that I installed composer as root, so I had to remove ./vendor, change the owner and group of ~/.composer to ubuntu:www-data (ubuntu is my user, www-data is the Nginx user), and rerun composer install. I also made sure the ./storage permissions were recursively set to 775, and change the owner of my entire Laravel project to ubuntu:www-data.
Some stuff will definitely be different if you're on Windows, but hope this helps!
It is a permission error actually. But if you try to run directly from your localhost server, it will work.
On windows 10 PHP Server will not be able to access PHP Pear extension that is why it is showing this error.
If you are running XAMPP. you have to go to your apache localhost with http://localhost/laravel-folder/public.
I've set up a Centos 6 + CPanel 11 VPS, and everything is as it was out of the box. I've installed Phorum 5.2.20 in the public_html directory, but Phorum is causing an error 500. The error log reports:
[Mon Jul 27 11:21:57.770447 2015] [core:error] [pid 14342] [client x.x.x.x:42531] End of script output before headers: admin.php
The code works fine on my Debian LAMP server (and several other non-Centos/CPanel LAMP stacks I've used to test this), and Wordpress and some other stuff runs fine on the CentOS machine.
I've tried other code too, and it works on my other servers, but doesn't work on CentOS. Phorum is the only code that matters, so I made question focuses on that. I'm also reluctant to edit the core files of Phorum.
Any ideas?
Fixed: Permission Issue
I have also faced the same issue after installing fresh installation on VPS, later I found It's a permission issue, Directory should be 755 and files should be 644 then only it works.
sudo chmod -R 755 projectfolder
sudo chmod -R 644 index.php //projectfiles
I think there is an issues with the php handler. Can you please try to change your php handler through WHM >>Service Configuration >> Configure PHP and suEXEC and check your URL again.
For me the error was caused by file permissions. Luckily it was just the one file causing it so I used the same permissions as the working .php files and it worked.
In my case 644 worked with enough permission to run and not too much to trip the security settings.
I had same error for more than a day finally i found out that accidentally my /home/mysite_username/fcgi-bin/php7.0.fcgi file owner and group was changed to root. Restoring owner to mysite_username solved this issue. (I'm using Virtualmin)
Fix permissions from User Account Menu of CWP.
I had a LAMP application running wordpress and I deleted the whole directory and replaced with new files - php based.
Now, when I go to view my server running CentOS - it just shows a 500 Internal Server error.
I've tried:
restarting server
restarting apache service itself
both completed successfully, but this didn't fix anything. Now, I do not know where to go from here.
apache logs # /usr/local/apache/logs/error_log on apache:
[Tue Apr 22 11:12:15 2014] [error] [] SoftException in Application.cpp:357: UID of script "index.php" is smaller than min_uid
I found the fix myself, this wasn't an error with Mysql at all, but rather a permissions issue with the index.php file I had.
The error, which I found in /usr/local/apache/logs/error_log was:
:is smaller than min_uid Premature end of script headers: index.php
To fix, I did this:
ls -l in the directory causing the issue (mine was public_html)
You should see the index file (e.g. index.php) that should be causing the issue. It is due to a root user having the only permission to the file and not your CPanel (or system) username. (note this system/cpanel name)
Run the following within the errorneous directory(Note: this command must be run within all subdirectories of the primary errorneous directory.):
sudo chown yoursystemuserhere:yoursystemgroupuserhere index.php
or to apply to the whole directory (thanks to #Prix):
sudo chown -R user:group /folder
You're all set.
Further literature here: http://www.inmotionhosting.com/support/website/general-server-setup/uid-smaller-than-min-uid
I hope this helps someone else in the future.
I had similar symptoms on my cPanel VPS - I was able to use easyApache to recompile Apache and PHP which fixed the problem for me.
(I realise my problem was slightly different to yours, but it may be helpful for people in the future who have the same problem I had).
chown -R user.usergroup /path_to_the_directory
Will resolve this. It is basically permission issues.
just install wordpress latest version make sure you have atleast php version 5.3 and above also look global register variable if it off or just delete htacess file from server and see what will happens
generally 500 internal server gives when file permission is missing so you should delete htacess file
OK, so I have this terrible problem with oci, apache, php and suse. First off, versions:
PHP 5.3.15 (cli)
Apache/2.2.22 (Linux/SUSE)
OCI8 1.4.9
SUSE 12.2 32 bit
Oracle client 10.2.0.4
Problem
I have really simple php file:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
oci_connect('user', 'passwd', 'host/sid');
?>
When I run it from command line it executes fine:
machine:~ # php oci.php
machine:~ #
But when i run it in browser, it gives me:
Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and point to the right directories
Apache configuration
I've been struggling with this issue for some time now and I'm pretty sure my apache configuration is correct.
I export all required variables before any apache process is started - I added
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/oracle/home/lib; export LD_LIBRARY_PATH
ORACLE_HOME=/path/to/oracle/home; export ORACLE_HOME
TNS_ADMIN=/path/to/oracle/home/network/admin; export TNS_ADMIN
NLS_LANG=POLISH_POLAND.EE8MSWIN1250; export NLS_LANG
at the beginning of /etc/init.d/apache2 script (I start apache by /etc/init.d/apache2 start).
Apache runs from wwwrun user, who is in oinstall and dba groups:
machine:~ # cat /etc/apache2/uid.conf
User wwwrun
Group www
machine:~ # id wwwrun
uid=30(wwwrun) gid=8(www) groups=8(www),113(oinstall),114(dba)
machine:~ # l $ORACLE_HOME
total 216
drwxr-xr-x 48 oracle oinstall 4096 Jan 25 17:07 ./
drwxrwxr-x 3 oracle oinstall 4096 Jan 25 17:01 ../
...
machine:~ #
Possible problem
I don't have any environmental variables in Environment section in phpinfo(); output - could this be the problem? If yes, how can I fix this? Is it some kind of security issue? I've read about problems like that with SELinux enabled, but I don't have it, my firewall is off.
Solution?
Any help would be greatly appreciated!
Problem solved! Thanks to these (Setting the Oracle Environment section) instructions and ken_yap's answer to this thread.
To put variables in Apache's Environment section you just have to add them in /etc/sysconfig/apache2 file: LD_LIBRARY_PATH=/path/to/oracle/lib.
Another solution ( that do not need root access ) is to add this lines in the php page:
putenv("ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1");
putenv("LD_LIBRARY_PATH=/opt/app/oracle/product/11.2.0/db_1/lib:/lib:/usr/lib");
Regards
For Debian users - edit file
/etc/apache2/envvars
on the end of file add link to your OCI library - eg.
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2
Another approach for Centos 7 with nginx
$ sudo vim /etc/ld.so.conf.d/oracle-instantclient.conf
// Add path to oracle client lib, the XX is the version, ex: /usr/lib/oracle/XX/client64/lib
$ sudo ldconfig
$ sudo service php-fpm restart
Done!