NGINX | HHVM | PHP - Unable to require anything but .txt files - php

I've setup HHVM & NGINX on my local machine, and it works perfectly without any problems. Last day I did it on my Ubuntu VPS, but with alot of errors, which mostly has been fixed, but the one I am unable to resolve is this one:
Fatal error: require_once(/usr/share/nginx/html/app/interfaces/interface.core.php): File not found in /usr/share/nginx/html/global.php
Now the issue is, that the path and file does exist, but this only works if I try to require a .txt file, but doesn't work with for example .xml neither. I have included the web path inside my server.ini file also: included_path = /usr/share/nginx/html
Other than that, HHVM & NGINX is setup correctly, it just isn't able to handle requires or includes, I don't know why.

Okay, after some research, I found out I had to chown the root folder of my webserver, but it didn't work with /usr/share/nginx/html. I had to move my files to /var/www/html and change the root folder, then I used this to grant entire folder permission access. sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 775 /var/www/html

Related

phpMyAdmin "Cannot load or save configuration"

I have been trying to setup phpMyAdmin on a macbook pro running yosemite 10.10.2. I have created a config folder in phpmyadmin and have given it the permissions required:
chmod o+wr ~/Sites/phpmyadmin/config
However, when I then go onto "localhost/phpmyadmin/setup" I get an error:
Cannot load or save configuration
Please create web server writable folder config in phpMyAdmin top level
directory as described in documentation. Otherwise you will be only able to
download or display it.
(I have tried attaching an image, but can't due to my reputation points)
I have tried resetting the permissions, tried deleting and recreating the folder. Tried redownloading the phpmyadmin zip but nothing seems to work.
Could anyone kindly advise me what I am doing wrong and how I am best placed to solve this issue?
I have had similar issue on my Ubuntu 16.04. I made a research and in the end I found a resolution of the issue. Maybe my case solution will help somebody else.
Background: For security reasons I have non privileged user and group apache:apache (sudo groupadd apache | useradd -g apache apache). They are preset by directives (User apache; Group apache) in /etc/apache2/apache2.conf. This user apache:apache owns Apache2 main directory (sudo chown -R apache:apache /etc/apache2) and some other files, for example: sudo chown -R apache:apache/etc/phpmyadmin/htpasswd.setup
In this manual: http://docs.phpmyadmin.net/en/latest/setup.html - I found that...
Debian and Ubuntu have changed way how setup is enabled and disabled,
in a way that single command has to be executed for either of these.
To allow editing configuration invoke:
/usr/sbin/pma-configure
To block editing configuration invoke:
/usr/sbin/pma-secure
Note! In the content of the two files listed above we talk about /var/lib/phpmyadmin/config.inc.php instead of /etc/phpmyadmin/config/config.inc.php. It was the key.
In my case I was modified the content of these scripts (see below) and now I can use localhost/phpmyadmin/setup properly.
/usr/sbin/pma-configure:
#!/bin/sh
echo "Unsecuring phpMyAdmin installation..."
echo "Setup script can now write to the configuration file."
echo
echo "Do not forget to run /usr/sbin/pma-secure after configuring,"
echo "otherwise your installation might be at risk of attack."
sudo sudo chown -R apache:apache /var/lib/phpmyadmin/config.inc.php
chmod 0660 /var/lib/phpmyadmin/config.inc.php
/usr/sbin/pma-secure:
#!/bin/sh
echo "Securing phpMyAdmin installation..."
echo "Setup script won't be able to write configuration."
sudo sudo chown -R root:root /var/lib/phpmyadmin/config.inc.php
chmod 0640 /var/lib/phpmyadmin/config.inc.php
I was able to use phpMyAdmin in my ~/Sites directory and remove the warning by giving the config folder writable access as such:
chmod 756 ~/Sites/phpmyadmin/config
Does it work if you try setting up PHPMyAdmin in system root versus user root? On OSX that server web root should be under /Library/WebServer/Documents?
I used this guide when I set mine up, and it works fine, although I did not use Sites as my root.
http://www.dingendoen.com/osx-installs-configuration-examples/install-apache-mysql-php-on-osx-yosemite/
For local development, changing permissions worked for an OSX Sierra install:
sudo chown -R _www:_www ~/Sites/phpmyadmin

Can not access copied filesin var/www ubuntu

I'm on Ubuntu 14.10 .
I copied a subdirectory which has project files (php, html, css) from xampp/htdocs on my Windows PC into /var/www/ of my ubuntu.
However, when I access those files from browser (I can not see the directory listing), I get 402 Object not found. Hence that, I installed Apache2,mysql 5.5 and phpmyadmin and also conducted update apt-get update for the system and I granted chmod-R 777 access to /var/www.
Any idea what might be the problem?
You must put the files on /var/www/html
Then try sudo chmod -R 755 /var/www/html

You don't have permission to access /marcon/assets/images/pic.jpg in apache php

I am getting this error
You don't have permission to access /marcon/assets/images/pic.jpg in apache php on my local Fedora 17, php,mysql and apache(not Xampp installation).
This error is occuring for any new files that I am copying to the directory.The older files /marcon/assets/images/header.jpg are accessible just fine. I checked the permissions and they are 777 (now) but still doesn't work.
This is a very wierd error. The subdirectory and other images work fine. Just the newer files don't work
This happens when I embed it as an image as well as when I access it directly. It works for all other files in the directory. Not just the newer ones
EDIT: Ironically this problem doesn't occur if i check the files into github and clone the project back again. Everything works hunky dory.
It is SElinux issue:
Try
$ ls -Z file1
you should get something similar to:
drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 scripts
if no try:
chcon -R -t httpd_sys_content_t /marcon/assets/images

Allow creation of folder on apache2 in Ubuntu Server

I'm creating a site which I'm going to host on an Ubuntu Server. I have a user registration form on my site, which creates a user and a folder for that user (if filled out correctly). The form in handled by PHP and I'm running Apache 2 on the server. When I run the code on my laptop the folder is created, but when I run the same code on the server the folder is not there. I guess that it has something to do with permisssion. How can I tell apache that the code should have write permission in a specific folder called "users" located in /var/www/mysite/public/users/ ???
Try using chmod command that provides folder permission. Something like
chmod 777 -R foldername
If security is not an issue I would suggest:
chmod 775 -R /var/www/
chown -R [your_user]:www-data /var/www/
So both apache2 (www-data) and you can edit folders and files inside /var/www (or /var/www/html if this is your folder).
Notice that this may have issues with git and other tools that capture folder permissions (eg with git you may commit files with 775).

Configuring Codeigniter framework on Linux

I've installed Codeigniter on Linux CentOS.
I extracted everything to my web directory, set everything up, and everything worked fine.
Next I moved my application/ and system/ folders outside the web directory, and then provide full path to them in index.php. The folders I provided resolve fine from the command line, but I continue to get the error:
Your application folder path does not appear to be set correctly. Please open the following file and correct this: index.php
Here are the full path locations:
$system_path = '/data/utilities/codeigniter/system/';
$application_folder = '/data/utilities/codeigniter/application/';
First, is utilitities a typo only here, or in your index.php, too?
Second, does Apache have full access to /data, utilities, and codeigniter?
What are the permissions of the folders? The Apache user might not have access to those folders. You can find out the permission by using the command ls -la and then set the owner or group to the Apache user chown www-data:www-data -R /data/utilitities/codeigniter/system/
and chown www-data:www-data -R /data/utilities/codeigniter/application/ (Assuming that the Apache user is www-data).
Permissions were not set correctly... silly mistake. I did this to fix it:
sudo chmod -R 755 /data/utilities/codeigniter/

Categories