Moving yii project to another machine - php

I have a project, build in Yii Framework , in my machine 1.
Now I moved my whole project to new laptop.
But it's not running and displaying some error:
Warning: require_once(D:\xampp\htdocs\rpadmin/../framework/yii.php): failed to open stream: No such file or directory in D:\xampp\htdocs\rpadmin\index.php on line 11
Fatal error: require_once(): Failed opening required 'D:\xampp\htdocs\rpadmin/../framework/yii.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\rpadmin\index.php on line 11
Does anyone know what is happening?

You need to edit in your project the file index.php and change the line:
// change the following paths if necessary
$yii=dirname(__FILE__).'/../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
with your Yii Framework path location.
If you have framework folder in the same location with the project, you need to change like this:
$yii=dirname(__FILE__).'/framework/yii.php';

actually u have folder of yii(framework named folder) framework outside the rpadmin folder now u have to upload it from your local machine to the server and put it outside the rpadmin from... the error message ...
Warning: require_once(D:\xampp\htdocs\rpadmin/../framework/yii.php):
so there will be a framework named folder....
after that make some changes
Give rpadmin/protected/runtime permission 777
If its ISS the you have to give rpadmin/assets folder permission 777
change the required settings in rpadmin/protected/config/main.php if theres only like db connection

Related

PHP require failing to open stream

I am struggling trying to figure out why my require path link is not working.
My folder setup is the following:
Main domain on server test.example.com.
public_html -> test.example.com -> PHPMailer -> PHPMailerAutoload.php
Since the main domain is test.example.com, I am putting test.example.com in the path url. I have to do this for any link on the site (it was a setup mistake, but I haven't changed it yet).
The way I am trying to access this folder is below:
require 'test.example.com/test.example.com/PHPMailer-master/PHPMailerAutoload.php';
I get the following errors:
Warning: require(test.example.com/PHPMailer-master/PHPMailerAutoload.php): failed to open stream: No such file or directory in /home/example/public_html/test.example.com/php/newsletterSend.php on line 4
Warning: require(test.example.com/test.example.com/PHPMailer-master/PHPMailerAutoload.php): failed to open stream: No such file or directory in /home/example/public_html/test.example.com/php/newsletterSend.php on line 4
Fatal error: require(): Failed opening required 'test.example.com/test.example.com/PHPMailer-master/PHPMailerAutoload.php' (include_path='.:/opt/cpanel/ea-php71/root/usr/share/pear') in /home/example/public_html/test.example.com/php/newsletterSend.php on line 4
I need the link to be an absolute path because the file will be used in different folders.
Does anyone see what I am doing wrong?
it looks like your php is in a directory above the phpMailer folder.. so i think the path would be "../PHPMailer/PHPMailerAutoload.php"
you can use absolute paths if its simpler:
/home/foo/public_html/test.example.com/PHPMailer/PHPMailerAutoload.php
or relative paths if you know where you're starting!
../PHPMailer/PHPMailerAutoload.php

Symlink - require_once doesn't seem to work?

I store my WordPress theme in my Dropbox to use it easily on many machines. Unfortunately require_once()/include_once() doesn't seem to work for me.
Is store original theme at G:\Dropbox\Dropbox\Wordpress\Themes\Blabla\
The symlink is placed at C:\xampp\htdocs\blabla\wp-content\themes\Blabla
When I wanted to require/include any file, eg. C:\xampp\htdocs\blabla\wp-load.php I used to do require_once('../../wp-load.php');
But with symlink all I got is:
Warning: require_once(../../../wp-load.php): failed to
open stream: No such file or directory in
G:\Dropbox\Dropbox\Wordpress\Themes\Blabla\foo\bar.php on line
2 Fatal error: require_once(): Failed
opening required '../../../wp-load.php'
(include_path='.;C:\xampp\php\PEAR') in
G:\Dropbox\Dropbox\Wordpress\Themes\Blabla\foo\bar.php on line
2
Looks like require_once looks for the file within the Dropbox, not symlink context? Is it possible to fix it somehow? I can't use absolute path as I develop on different machines / different OSes and those vary... Any ideas? How does require_once work when it's symlinked? Does it look for required file in both places (original-context & symlink-context)?
How about putting the original file into you Wordpress folder and symlinking to dropbox?
While installing this, you should turn off dropbox on all machines where you did not move the folder yet.

Laravel 4 bootstrap/autoload.php failed to open stream

When I uploaded my Laravel 4 application on a live web server I get the following error when going to the base URL:
Warning: require(/home/pvanmoll/domains/iheal.be/public_html/../laravel/bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home/pvanmoll/domains/iheal.be/public_html/index.php on line 21
Fatal error: require() [function.require]: Failed opening required '/home/pvanmoll/domains/iheal.be/public_html/../laravel/bootstrap/autoload.php' (include_path='.:/usr/local/lib/php') in /home/pvanmoll/domains/iheal.be/public_html/index.php on line 21
I have put my laravel-files in a separate folder next to public_html. In public html I put the content of laravel's public folder.
This is my data structure:
laravel
/app
/bootstrap
/vendor
...
public_html
/css
/js
index.php
...
In index.php I specified following lines:
require __DIR__.'/../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/start.php';
and in laravel/bootstrap/paths.php:
'public' => __DIR__.'/../../public_html',
On localhost everything runs fine, but when I upload it to my live web server, it won't work. I've been searching for days now and nothing can help me. Weird thing is that the two dots for going down a folder, won't work as they are just appended to my url instead of going down a folder.
Maybe it's because my web server is running on Php 5.3.27?
You need at least PHP >= 5.3.7 with L4. And why don't you change the web root on the server instead? Is it shared hosting?
You could also put all laravel install inside public_html, update bootstrap/path.php and index.php and redirect to laravel public with a htaccess. But this is definitely not recommended !

Web application not finding file in what appears to be the correct path

I tried to reorganise my facebook application files into better folders and now when I try to load my application on facebook it throws the following error:
Warning: require_once(../scripts/mysql_connect.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\<root folder>\Model\Database.php on line 3
Fatal error: require_once() [function.require]: Failed opening required '../scripts/mysql_connect.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\<root folder>\Model\Database.php on line 3
The second error is a result of the failure of the first one I think. The weird thing is that my program works perfectly fine when I'm accessing through the localhost url in the browser but when I run it through facebook it throws this error.
In my root folder I have a "Model" folder where the Database.php file is kept and a "scripts" folder where the mysql_connect.php file is kept. I have tried clearing my cache on the browser and using private browsing but it is still throwing this error.
Does anyone know what could be wrong?
EDIT: Sorry this does not seem to be working in localhost either now! One thing I think is weird is that it says "failed to open stream : NO SUCH FILE OR DIRECTORY IN" and then lists the database.php path. Why is it looking in there?
I use the line require_once('../scripts/mysql_connect.php'); at the top of my Database.php file to include it.
It seems that on the server there is a different working directory. Something like the following owuld be a quick fix
dirname(__FILE__) . '/../scripts/mysql_connect.php'
Ok I've fixed this, but I'm still unsure why it was a problem. In my root folder I have two folders: scripts, and Model. I have a database.php file in my Model folder which has the following line of code in:
require_once('../scripts/mysql_connect.php');
For some reason this did not work, but by replacing the line with:
require_once('/scripts/mysql_connect.php');
This started working again! Just thought I would post the solution. Does anyone know why the other way failed? I thought the ".." just makes it go up one level in the folder hierarchy i.e. to the root folder in this case, and then follow the path which would have taken it to the file...
EDIT: This appears to only have solved it for localhost and not through Facebook...
Do you have permission to edit your php.ini file? One solution would be to find the line with the include path (you'll notice it has C:\xampp\php\PEAR in there already). Include the full path to the "scripts" folder you're referencing, then you can change the php code to read:
require_once('mysql_connect.php');
PHP will be able to find this file since it's in the include path. Just make sure that if you start adding several include paths that you shouldn't have a file named mysql_connect.php in two or more of the different include paths because you'll most likely get errors. Hope this helps. It definitely makes for some cleaner code.

Smarty permissions problems

Smarty is complaining about permissions. I've written a small mvc framework for a project I'm working on and I need to be able to render templates in each controller. I went ahead and followed the Smarty installation instructions, and set all of the configuration options in my "front controller", or the page that routes requests to the rest of the application. The testinstall function says everything is kosher, yet when I attempt to render templates in my controllers, I end up with this.
Warning: mkdir(): Permission denied in
/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php
on line 28 Warning:
rename(/tmp/wrt6piczo,./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php):
No such file or directory in
/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php
on line 48 Warning: chmod(): No such
file or directory in
/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php
on line 50 Warning:
include(./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php):
failed to open stream: No such file or
directory in
/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php
on line 423 Warning: include(): Failed
opening
'./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php'
for inclusion
(include_path='.:/usr/share/php:/usr/share/pear')
in
/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php
on line 423
I have tested the rest of my framework independently and everything seems to work. My "front controller" routes requests properly to the correct controllers, and I seem to be able to render regular HTML just fine.
Additionally, I have chmodded all of the Smarty library folders as well as the other required directories to 777 just for the sake of testing. I'm still receiving the same permissions errors.
EDIT
These are the settings I've used for all the required smarty folders.
$smarty->setTemplateDir('lib/smarty/templates');
$smarty->setCompileDir('lib/smarty/templates_c');
$smarty->setCacheDir('lib/smarty/cache');
$smarty->setConfigDir('lib/smarty/configs');
Proper permissions solved it for me:
chown -R www-data /var/www/HRTRL
Could it be a problem with relative paths? Could you add the complete paths for you set****Dir functions, so you'll be sure you're using the correct locations.
If you call this from a /specialdir/thisdirhasonlyaPHPfile/file.php location, you might get in trouble.
For anyone else dealing with permission issues with Smarty after following all of the above (Checking config/chown/chmod etc...) We came across an issue whilst running Smarty on SE(Security Enhanced)Linux.
The compile/cache directories were sub-directories inside of a ~/tmp directory.
The default targeting policy prevents writes to tmp directories.
You can use semanage to update contexts/policies. You'll most likely need to create a new policy to assign the httpd_sys_rw_content_t context to the directory your web-app needs to write too.
More information:
http://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-selinux-policies-for-apache-web-servers/
t
Simply comment the following line from the index.php file.
$smarty->caching = true;
This will solve your problem.
You should check again access permission for write.
I had the same errors, so I have set permissions to 777 for 'templates_c' folder and anything inside of it and now it works.
However I had to repeat this operation for 3 times in Filezilla, don't know why it didn't change the permissions at once.
According to the documentation, permission of 'template_c' folder should be 775. But it does not work sometime. You have to set its permission to 777.

Categories