xampp not recognizing the paths - php

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?

Related

Troubles with XAMPP(or?)

I just started taking a PHP course and I'm having a lot of difficulties. I won't get anywhere unless this is resolved.
I got the course files downloaded and added them to htdocs folder but I can't run any new files I created. I get
Object not found! 404 error
I see them under localhost/coursefiles/whtever.php. I've google searched all day but can't find anyone else having this specific problem.
Would uninstalling and reinstalling XAMPP work? This is extremely frustrating and making me crazy.
First Check xampp manager Is your MySQL and Apache is in running state ?
Then Type Localhost in your browser , if Xampp Homepage is Coming It means Xampp is working Fine!
And again Checj your course files Extension they should have .php extension (if they are php files).
Create An folder In your Htdocs Folder With Abc(for example) and Write in browser's Url window "http://Localhost/Abc
if your Folder is opening and it's showing Files Then There must be a Problem with files! :)

PHP apache document root need to create an alias for url resolution

So I inherited some PHP code.
I installed XAMPP on my windows machine
I changed the DocumentRoot and Directory paths to
C:\dev\CustomCloud\prod
However, now when I visit localhost I see tons of 404 errors
Seems the PHP code is trying to resolve an ALIAS of localhost/matchmaking/
Example:
C:\dev\CustomCloud\prod\assets
Is
http://localhost/matchmaking/assets/
What is the best or easiest solution to resolve this as I rarely work with PHP, but I need Apache to serve up this code locally so I can work with the code a bit etc...
In your browser url put line https//:localhost if it showing apache home page.Then apache is install successfully on your windows PC ..Then make one file in xammp--> htdocs-->index.php in this file put following code or your folder which you want to run on browser.
<?php
echo phpversion();
?>

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.

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.

Apache doesn't execute my copied PHP files, but testing.php works

I've just installed LAMP on my Ubuntu 9.10 machine, and everything works fine except when I copy my PHP files from another computer.
The LAMP guides I've followed also made me create a phpinfo() test file, which works, but when I try to type in e.g. index.php absolutely nothing happens - just a blank page in FireFox. :(
The files are in the exact same directory.
I'm thinking it's probably something with permissions and so on, but since I'm new to both PHP and Ubuntu, I'm kind of lost. It's like I can't create a PHP file with my file browser, but only by using the terminal - like when I created the testing.php from the LAMP guide.
Whaddayaknow... I made an error, tried to:
echo "Hello" world
which, even though I'm a PHP noob, I clearly know is wrong.
I think I'll have to figure out how to enable some sort of error reporting, a blank page is clearly not good enough.
You mean you have a index.php (copied from another computer) and a test.php (edited by hand, with a call to phpinfo()) in the same apache directory, the second works from your browser and the first doesnt ?
That can be a permission issue, or some compilation error in your php.
About permissions, for files should be readable from the apache server (more precisely, form the user that runs the apache server). You can type chmod a+r index.php.
YOu can also check your apache error logs (location dependent on installation). In any case it's vital to know where the error logs are if your are developing a web site.

Categories