phpfog Application runtime path is not valid - yii

I'm trying to implement a little default application that comes with yii framework on phpfog.
I've installed it according to the instructions using GIT. Now, when I try to run it, I get this error (below).
I've checked to make sure that the directory is writeable and that the directory called for does exists. I'm stuck, what do I do next?
Application runtime path /var/fog/apps/app35423/austintxous.phpfogapp.com/demos/emp/protected/runtime" is not valid.
Please make sure it is a directory writable by the Web server process.
259 return $this->_runtimePath;
260 }
261 }
262
263 /**
264 * Sets the directory that stores runtime files.
265 * #param string $path the directory that stores runtime files.
266 * #throws CException if the directory does not exist or is not writable
267 */
268 public function setRuntimePath($path)
269 {
270 if(($runtimePath=realpath($path))===false || !is_dir($runtimePath) ||
!is_writable($runtimePath))
271 throw new CException(Yii::t('yii','Application runtime path "{path}" is
not valid. Please make sure it is a directory writable by the Web server process.',
272 array('{path}'=>$path)));
273 $this->_runtimePath=$runtimePath;
274 }
275
276 /**
277 * Returns the root directory that holds all third-party extensions.
278 * #return string the directory that contains all extensions. Defaults to the
'extensions' directory under 'protected'.
279 */
280 public function getExtensionPath()
281 {
282 return Yii::getPathOfAlias('ext');
283 }

The web server cannot write to the runtime directory. Make sure it exists, and change ownership of it to your web server, or set chmod 777 (which is a fine solution if it's your dev environment).
cd [project directory]
chmod 777 protected/runtime

Have you got a firewall running?
Maybe it's preventing write access?

you must config with semanage like this which allow php-fpm write access to directory
# semanage fcontext -a -t httpd_sys_rw_content_t 'YOUR_PATH_HERE'
# restorecon -v 'YOUR_PATH_HERE'

Related

Error setting up WORHP license and parameters file

I am trying use WORHP toghether with AMPL on my Linux Mint (v19.3) machine, but I just can't figure out how to properly set up the license file (and probably the .xml file as well).
I've placed AMPL's and WORHP's binaries, as well as libworhp.so, .lic and .xml files, in the same directory as follows:
user#laptop:/opt/AMPL$ ls -la
total 121676
drwxr-xr-x 3 root root 4096 May 30 22:38 .
drwxr-xr-x 9 root root 4096 May 29 21:43 ..
-rwxr-xr-x 1 500 users 1226960 May 2 17:47 ampl
-r--r--r-- 1 user user 690 May 29 20:01 ampl.lic
-rwxr-xr-x 1 root root 4100512 May 29 22:00 libworhp.so
-r--r--r-- 1 root root 175 May 30 22:53 rosenbrock.mod
-rwxr-xr-x 1 root root 339400 May 29 21:43 worhp_ampl
-r--r--r-- 1 user user 1122 May 30 21:56 worhp.lic
-r--r--r-- 1 root root 20239 May 29 22:34 worhp.xml
The binary file is called worhp_ampl and rosenbrock.mod is a valid AMPL example file.
Still, I get the following error message whenever I try to solve the model with:
user#laptop:/opt/AMPL$ ampl rosenbrock.mod
ReadParamsNoInit: Used parameter file worhp.xml
* Read 268/268 parameters.
WORHP: Using data file /tmp/at9188. Error (License): Could not open license file.
* Local MACs:
- 00:90:f5:93:e9:62
- 74:f0:6d:85:27:ee
WorhpInit: Could not obtain license.
Unsuccessful termination: License error.
Error (AMPL_Init): Error in WorhpInit.
exit value 1
<BREAK>
This error only happens if I set WORHP's corresponding parameter and license environment variables (because I need to use WORHP and AMPL outside of this installation directory).
user#laptop:/opt/AMPL$ echo $WORHP_PARAM_FILE
:/opt/AMPL/worhp.xml
ueser#laptop:/opt/AMPL$ echo $WORHP_LICENSE_FILE
:/opt/AMPL/worhp.lic
On the other hand, everything works (only inside the /opt/AMPL directory) if I remove the declaration of WORHP_PARAM_FILE and WORHP_LICENSE_FILE from my .bashrc.
I couldn't figure out how to do this just by reading WORHP's User's Guide, so I would like to kindly ask for a little help with this issue.
I managed to fix the problem by adding the following to my .bashrc file
WORHP_PARAM_FILE=/opt/AMPL/worhp.xml
export WORHP_PARAM_FILE
WORHP_LICENSE_FILE=/opt/AMPL/worhp.lic
export WORHP_LICENSE_FILE
Instead of the previous:
export WORHP_PARAM_FILE=$WORHP_PARAM_FILE:/opt/AMPL/worhp.xml
export WORHP_LICENSE_FILE=$WORHP_LICENSE_FILE:/opt/AMPL/worhp.lic

Could not move uploaded file to destination Drupal 8

I have a trouble gatting drupal to upload files (images, configuration, I guess anything).
The error message is:
The file could not be saved because the upload did not complete.
File upload error. Could not move uploaded file.
When I go to log it says:
Upload error. Could not move uploaded file multimedia.svg to destination public://2017-03/multimedia.svg.
I already read about permissions and here they are:
sites/default/files - 770
sites/default/files/2017-03 - 770
/tmp - 1777
However I'm able to upload & install themes and modules without any ploblems at all.
So what could it be? And how do I fix this?
switch php mode from "Apache module (mod_php)" to "Fast CGI (mod_fcgid)"
core\includes\file.inc
function file_prepare_directory()
should return true
see this patch
or just temporarily put
return true;
instead of
return $writable;
in the function

Moving Smarty website to new server

I'm moving a website to a new domain and server and I'm running into some problems. This website works with Smarty, and I've never used it before. I think I got a very basic problem, but I can't find the answer online.
I've moved all the FTP files to the new server
I've copied the database
I've edited the config file with the new database information
Now only EVERY page (even a blank test.php file with a simple echo) I get "failed to open stream" errors.
Warning: rename(/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.rename]: failed to open stream: Permission denied in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 48
Warning: rename(/tmp/wrtPBIHNP,/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.rename]: Permission denied in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 48
Warning: chmod() [function.chmod]: No such file or directory in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_write_file.php on line 50
Warning: include(/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php) [function.include]: failed to open stream: No such file or directory in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_template.php on line 432
Warning: include() [function.include]: Failed opening '/home/*websitename*/domains/*websitename*.com/public_html//skins/default/compiled/65e3d4d7349f9687ce73f56b61992749304409a2.file.index.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/*websitename*/domains/*websitename*.com/public_html/external/smarty/sysplugins/smarty_internal_template.php on line 432
It looks like a problem with premissions, but I've made EVERY file on the FTP premission 777 (to test) and this does not solve it.
There are two backslashes /public_html//skins/ which is weird.
The code is exactly the same on the "old" server, besides the config file. Only thing new is the domain name.
What am I doing wrong?
You should set for directory compiled permissions 755 or 777.
You should probably also remove all compiled and cached files (if you use cache) because it may also cause problems

nfsnobody User Privileges

I have setup an NFS file share between two CentOS 6, 64 machines. On the server the folder being shared was originally owned by the root user. On the client it turned up as being owned by nfsnobody. When I tried to write to the folder from the client I got a permissions error. So I changed the folder ownership on the server to nfsnobody and chmod'd it to 777. However, still no joy - I continue to get a permissions error. Clearly, there is more to this. I would be much obliged to any Linux gurus out there (I personally wouldn't merit being called anything more than a newbie) who might be able to help fix this issue.
Edit - I should have mentioned that trying to write to the shared folder from the client actually manages to create a file entry. However, the file size is 0 and the permissions error is reported.
The issue here is to do with the entry in /etc/exports. It should read
folder ip(rw,**all_squash**,sync,no_subtree_check)
I had missed the all_squash bit. That apart, make sure that the folder on the server is owned by nfsnobody. On my setup both my client and server nfsnobodies ended up with a user id if 65534. However, it is well worth checking this (/etc/groups) or else... .
Here are a couple of useful references
How to setup an NFS SErver
NFS on CentOS
For the benefit of anyone looking to setup an NFS server I give below what worked for me on my CentOS 6 64bit machines.
SERVER
yum install nfs-utils nfs-utils-lib - install NFS
rpm -q nfs-utils - check the install
/etc/init.d/rpcbind start
chkconfig --levels 235 nfs on
/etc/init.d/nfs start
chkconfig --level 35 rpcbind on
With this done you should create the folder you want to share
mkdir folder
chown 65534:65534 folder
chmod 755 folder
Now define the folder to be shared/exported. Use your favorite text editor (vi or whatever) to
open/create /etc/exports
folder clientIP (rw,all_squash,sync,no_subtree_check)
Client
Install, check, bind and start as above
mount -t nfs serverIP:folder clientFolderLocation
If all goes well you should now be able to write a little script on your client
<?php
$file = $_SERVER['DOCUMENT_ROOT']."/../nfsfolder/test.txt";
file_put_contents($file,'Hello world of NFS!');
?>
browse to it and find that test.txt now exists on the server with the content "Hello world of NFS". In the example I have placed my mounted drive one level before document_root.

Can't upload tmp file / file uploads won't work

I just switched to a dedicated server. All of the sudden I can't upload files. My best guess because the tmp file isn't getting uploaded? Each time I try to do move_uploaded_file('tmp','new_image'); I get permission denied and failed to open stream.
I changed nothing in the script; but the absolute path obviously. Also, all file permissions are set to 705. I think it's something to do with the php.ini where the tmp files aren't working... I no longer have the default php.ini from shared hosting. Any ideas what might be causing this? Thank you
Here's my php.ini
extension_dir = ./
upload_tmp_dir = ./tmp
-- more but not relevant
`Warning: move_uploaded_file(users/126/question_images/question mark.jpeg): failed to open` stream:
Here's the permission denied error
Permission denied in ---.php on line 115 Warning: move_uploaded_file():
Here's the other error
Unable to move '/tmp/phpVrkytD' to '---.jpeg' in .---.php on line 115
Here's the part of the script to upload the image
$long_image_loc = 'absolute_path/'.$image_name;
if(move_uploaded_file($image_tmp_name, $long_image_loc) === true) {
return true;
}
This worked worked perfect on shared hosting. It's a really straight forward image upload script.