how to Load Helpers in Codeigniter on Linux machine? - php

i was working on Codeigniter Application in WAMP and then i had to move my project to a LINUX machine.
Now When i have installed LAMP there. but When i try to access my application i get an error:
An Error Was Encountered
Unable to load the requested file: helpers/url_helper.php
i checked my autoload.php. This worked on my windows don't why its not working here.
$autoload['helper'] = array('url','html','crm_helper','form');
Can you please guide me where i am going wrong?

From your modified question, it seems that you are in fact missing the url_helper in your autoload line. It should be like this:
$autoload['helper'] = array('url','html','url_helper','form');
Also include the exact version of codeigniter that you've installed, in your question.

This happened to me ! on my local windows system it was fine ,but when i migrated to Linux server (my hosting server )then it generate the same error: it was due to case-sensitivity of Linux.
these are two deffrent words in linux:
'crm_helper'
'Crm_helper'
so i suggest you to check your files name ,
Linux system crm_helper and Crm_helper are two different files.
remove _helper while loading any helper file / code

Related

xampp not recognizing the paths

I just installed Xampp portable on a flash drive as my test environment and all services works fine. I copied my website folder from my webserver to the htdocs folder of the xampp and now xampp doesn't recognize the paths to the include_once's in the webpages and it says: Fatal error: Call to undefined function checkmobile() in F:\xampp\htdocs\mySite\includes\html_head.php on line 15
ie, there is a include_once checkmobile.php above the line 15 but the xampp doesn't recognize the path! BTW, this works from my webserver...
I am trying to keep the paths the same so when I transfer the website files back to the production server, I don't have to change all the paths again...
Any solution to this?
Am I doing something wrong or have to modify some config files in xampp?
It shouldn't be an issue as long as you aren't hard coding the path. What is your directory structure (just an outline is fine) and can you give us a snipped of the code with the include request in it?

CodeIgniter was insensitive about case, and now it is?

So basically, I ran XAMPP on my Mac and I built a pretty huge CI website. It worked perfectly.
I then when to make a DigitalOcean account, installed Ubuntu+Lamp, put my database there, and then uploaded my website.
On the very first page, I get this error:
Unable to load the requested file: Login_view.php
I checked, and indeed there was no file called Login_view.php WITH AN UPPERCASE L. But there was a file called login_view.php, that on my XAMPP server it was able to load perfectly well.
I guess this has to do with case sensitivity, and since it's 1:1 the exact same CI project I have on my localhost, I guess it's something to do with the configuration of the server.
How can I configure my Ubuntu server, or the Apache, to be case insensitive with CI?
You can use Apache mod_speling with the CheckCaseOnly directive.

Deploying Laravel Over FTP

I am working on deploying a Laravel app to a bluehost server and I am running into some trouble.
Currently, I uploaded all of the Laravel files to the root of the server, then uploaded the contents of the "public" folder to the "public_html" folder. From here I opened the "bootstrap/paths.php" file and changed the public path to
'public' => __DIR__.'/../public_html',
After this, I am still unable to get content to display. Am I missing something? It looks like bluehost is running PHP 5.4.24.
Any help with this would be appreciated.
Thanks!
EDIT: The error log shows
[09-Apr-2014 09:04:02] PHP Fatal error: require() [function.require]: Failed opening required 'DIR/../bootstrap/autoload.php' (include_path='.:/usr/lib64/php:/usr/share/pear') in /home1/regmuel/public_html/index.php on line 21
Could anyone help me figure this error out. I can clearly see what the problem is, I'm just not sure how to go about fixing it.
It looks like __DIR__ isn't getting parsed, are you sure your host isn't running PHP 5.2.* if you run phpinfo() on your host what version does it give?
__DIR__ is only available from PHP 5.3.0 onwards
RMcLeod's answer is perfect, just wanted to add to it something that I ran into with my web host (specifically Bluehost). Even after the version of PHP running on the server was 5.4.40 (found using php -v via an SSH terminal), I was running into the same problem where it was picking up an older version of PHP when interpreting my index.php and wouldn't recognize the DIR constant.
I had to add the line
AddHandler application/x-httpd-php54s .php
to the top of the .htaccess file which is in the same folder as my index.php
Just for context, I was trying to set up my laravel 4.2 app on bluehost and it relies heavily on this constant.

Magento installation issue windows 7 / wamp 2.2

I have wamp 2.2 installed on my windows 7, which has php 5.3.10.
I am trying to install magento 1.7.0.2 and getting following error.
when accessing like 127.0.0.1/magento/
The connection was reset
when accessing like localhost/magento/
it redirects me to http://www.localhost.com/magento/ and says
ERROR The requested URL could not be retrieved
What is the problem and how to fix it?
Installing Magento on Wamp is a bit of a pain. I would recommend giving ampps a go: http://www.ampps.com/
It is best to install complex applications like Magento into a Named Virtual Host.
If you have never done that with Apache before here is a quick tutorial/HowTo
Steps to install magento on windows
Download and install wamp server. Link - http://www.wampserver.com/en/
Download Magento. Link - https://www.magentocommerce.com/download, select the .zip format for windows.
Unzip the magento into the path c:/wamp/www/
Add the line 127.0.0.1 www.yourdomain.com to the host.ics file in c:/Windows/System32/drivers/etc/, where 127.0.0.1 refers to the localhost.
Create an empty database in using phpMyAdmin.
Now open your browser and run the link www.yourdomain.com which will open the magento installation wizard.
Complete the installation
I got its answer after consulting one of my friend.
It can be done with a small trick
go to
C:\wamp\www\magento\app\code\core\Mage\Core\Controller\Varien\Router
folder
open Admin.php
and find _shouldBeSecure function and redefine
like
protected function _shouldBeSecure($path)
{
return ; // ie return false, say no to secure path as your localhost
does not need it. }
Now try to install your magento. It will work like charm .

xampp - filepath error in config - mac with VMWare Windows 64 install

I am having a problem getting xampp to render an existing project I just began to work on. Its a bit of an odd configuration: This is a Mac with VMWare running a Windows 64 image. The other devs on this project are running strait Windows which is why I'm doing it this way.
The basic problem is running a php script I have inside the project folder inside htdocs. So I get this:
Fatal error: require_once() [function.require]: Failed opening required 'C:/xampp/**htdocs/includes**/page-include.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\**htdocs\mb314\index**.php on line 2
Notice that it is looking for the includes/page-includes.php inside htdocs/ when the actual location of it is htdocs/mb314/ ... even though it is not having a problem finding the index.php file inside htdocs/mb314. So not sure what the error message is telling me.
Also, one of the .NET devs on this team suggested I edit my hosts file in (C:\WINDOWS\system32\drivers\etc) to add 127.0.0.1 localhost/mb314 at the bottom. But I don't know much about the Windows environment and whether 32v64 bit could be a problem or if the VMWare might have something to do with it.
I'm pretty sure this is a basic xampp configuration problem; just with an unusual platform combination ... which is why I'm asking for help.
Any suggestions would be appreciated
$_SERVER["DOCUMENT_ROOT"] is based on your virtual host directory definition in php.ini. But you shouldn't change it from there. You can set a global configuration variable in your php files when you're working on a project in its own folder to point its relative folder from the document root.
I mean: in a file that you include on every file you work on your "mb314" project:
$base_dir = "/mb314/"; // for example.
Then you can use your url's like this
include_once $base_dir . "includes/page-include.php";
And when you upload your project to the web, you may just change your base_dir variable to:
$base_dir = "/";
And that'll be enough.

Categories