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

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.

Related

Can't run PHP after a new installation of XAMPP

I have been a happy user of XAMPP for years,
but today I have updated to the latest Windows 32 bit version on a Windows 10 machine.
I couldn't see a 64 bit version.
Anyway, all went well,
and once I changed some settings, I was able to see all my old databases under the new phpMyAdmin.
But my PHP scripts are bombing out before they start.
Even phpinfo gives the same error message, which is...
"Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'F:/My Documents/OneDrive/Webs/htdocs/index.php'
(include_path='.;C:/xampp/php/pear/PEAR') in Unknown on line 0"
The test script of index.php is nothing more than
<?php echo "HELLO"; ?>
The statement in php.ini is
include_path = ".;C:/xampp/php/pear/PEAR"
and there are no other include_path statements.
The directory C:/xampp/php/pear/PEAR does exist.
The index.php file is there.
I don't know why there's a PEAR folder inside a pear folder - that's how Xampp installed it.
I have tried all variations of that include_path statement to no avail.
I have left out one of the pears.
Leaving out the include_path statement altogether just results in the PHP default which is a folder which is definitely not there, so that's no good.
My localhost is inside the OneDrive folder as you can see from the error message, but I have been doing it that way for years.
Now I cannot run any PHP scripts. Pure HTML is no problem.
The new installation of Xampp has totally replaced the old one, and its Control Panel v3.2.2 looks to be working perfectly.
phpMyAdmin seems to be working fine, but not phpinfo, as said.
I have scanned the web for answers to this, and there is plenty of forum Q&A's, but they all tell me to do what I have done.
The computer is Windows 10 Pro, and is fully up to date. Apache 2.4.33.
PHP 5.6.35. Database server is 10.1.31 MariaDB.
I've run out of ideas. Any help will be appreciated.
Thanks Mike.
You need to fix your include_path system variable to point to the correct location.
To fix it edit the php.ini file. In that file you will find a line that says, "include_path = ...". (You can find out what the location of php.ini by running phpinfo() on a page.) Fix the part of the line that says, "\xampplite\php\pear\PEAR" to read "C:\xampplite\php\pear". Make sure to leave the semi-colons before and/or after the line in place.
Restart PHP and you should be good to go. To restart PHP in IIS you can restart the application pool assigned to your site or, better yet, restart IIS all together.
first: check all the paths in the php. ini ( use a search or a grep to check them)
second: check that you don't have any extensions added twice (one in the beginning and one in the end of the file)

how to Load Helpers in Codeigniter on Linux machine?

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

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?

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.

Exclude direct paths on server, i.e. css, js, etc

I am experimenting with Laravel 4, I have successfully installed and did a couple things and that. Unfortunately, I cannot load any CSS into my HTML.
The CSS url is correct, which I used HTML::style('css/bootstrap.css'); to generate for me.
When I access the URL (currently on localhost) http://laravel.dev/css/bootstrap.css, it gives me an error:
Not Found
The requested resource /css/bootstrap.css was not found on this server.
The file is stored in /public/css/bootstrap.css, why can't Laravel avoid this? How would I overcome this issue? It seems that the route is going forward with the application rather than finding the file on the server.
I am running Laravel on my localhost environment, PHP 5.4.0, Mac OS X 10.7.
You probably have a problem with your virtual host or .haccess file, because
HTML::style('css/bootstrap.css');
Should point to
http://laravel.dev/css/bootstrap.css
And it is doing it correctly, but your virtual host configuration for http://laravel.dev/ should point to
/var/www/laravel.dev/public/
So, that file, in fact, is
/var/www/laravel.dev/public/css/bootstrap.css
If you get a file not found on
/css/bootstrap.css
Then I have to assume this is a virtual host or rewrite (.htaccess) configuration problem.
You have to put the assets folders in your root outside public directory according to HTML::style.
Otherwise you can access by http://laravel.dev/public/css/bootstrap.css

Categories