|
another suggestion: if you know or can calculate your folder depth (currently requested script's distance from the web root) try this:
$sDepth='../../';
require_once($sDepth.'file1.php');
|
|
|
|
|
Your code works fine for me (XAMPP 1.6.6a; PHP 5.2.5).
Look again Monday!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
<?php
$path_root = $_SERVER['DOCUMENT_ROOT'].'/';
echo $path_root;
include($path_root.'aaa.php');
include($path_root.'bbb.php');
?>
* Error: : "Warning: include(C:/Program Files/EasyPHP-5.3.5.0/wwwbbb.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.5.0\www\index.php on line 9
It seems to me that, for any unknown reason the last '/' is getting removed automatically after using it inside an include clause.
|
|
|
|
|
Three comments:
1.
that looks like a bug then, in your PHP system.
2.
why do you feel a need to specify an explicit path in an include? I never do that, I use relative paths. Wouldn't
include('aaa.php');
include('bbb.php');
work well?
3.
please try again with a backslash in $path_root.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: that looks like a bug then, in your PHP system
It had no sense to me... Strange behavior.
Luc Pattyn wrote: why do you feel a need to specify an explicit path in an include?
Probably this is again a bug then... I've tried to use relative paths like '../aaa.php' and so on, but the problem here is that I'm using some files from different locations and those files seem to inherit (somehow) the original path... then the relative paths change depending on the file that is including the file that includes another file... Using the doc_root helps me avoiding this problem...
Luc Pattyn wrote: please try again with a backslash in $path_root.
Done it already... it don't wants to work...
Thank you for your answer!
|
|
|
|
|
you're welcome.
FYI: I typically use:
require_once("includes/somename.php");
i.e. my pages are at the top level of the web site, my dependencies one level down. Never had a problem with it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
$path_root is a global variable, so maybe something in the 'aaa.php' include (or another file included by that) is modifying it.
|
|
|
|
|
Nice suggestion, I tried this the first thing... searched for all the $path_root variables in the web site in order to find any inconsistence...
The only thing it can happen here is that the include clause is removing the last / in the file path.
I works once, it never works again.
|
|
|
|
|
PHP has two ways for specifying strings.
single quotes ''
double quotes ""
$car = 'Holden';
$sq = 'My car is a $car'; //My car is a $car
$dq = "My car is a $car"; //My car is a Holden
With double quotes the variable is inserted.
If you are using an array or want to seperate a variable in double quotes use braces.
$array['tv_show'] = 'American Idol';
$br = "{$array['tv_show']} is terrible but {$car}'s are awesome";
for the example above use "{$_SERVER['DOCUMENT_ROOT']}/FILE.php";
It may be that you are using windows and the interpreter could be swapping a '/' for '\'.
|
|
|
|
|
Hi,
just wondering if we can create a library(dll type) in php netbeans like we can in .NET.
it's just that i have set of data class and business logic classes and i want to keep them in a seperate library and include that in different projects.
Other question is if it's good way to have library in php or is it better to include each class as and when required ??
Thanks
|
|
|
|
|
|
كيفية الطباعة من mySQL مع حفظ الرئس الصفحة
|
|
|
|
|
Please post your question(s) in English only.
I must get a clever new signature for 2011.
|
|
|
|
|
Hello !
i'm running redhat enterprise 5.5 on a computer with some other operating systems.I need to hide the partitions of other OS from places in linux for all users including root.What can i do ?
Thank you in advance !
|
|
|
|
|
that's a tough one... what other OS are you working with? one possible way would be to place those partitions on a second physical drive then just don't mount that drive in linux. that'll keep ppl from seeing it, but they can always mount the drive by hand if they know its there.
|
|
|
|
|
This may be useful: http://www.justlinux.com/forum/showthread.php?t=149828[^]
Also, many programs that format/create partitions allow you to hide partitions.
See if you can crack this: b749f6c269a746243debc6488046e33f So far, no one seems to have cracked this!
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Hi I want have several button or link in my form that everyone do something ,
So my form have several lesson’s name in front of everyone is button that if you click on it show you the program of that lesson how can I do this ?I want to show another form that show the program’s lesson
But I can’t access the variable please guide me
|
|
|
|
|
I am trying to integrate php scripting into my application using the windows ScriptControl object. VBScript and JScript are working well on a broad variety of platforms including Vista,XP, server 2008r2/2003/2000.
Can not get php scripting to work. This wsf file pops-up a 'hello world' window, but wscript crashes.
<job id="test">
<script language="PHPScript">
$WScript->Echo("Hello World!");
</script>
</job>
and I get this:
Faulting application WScript.exe, version 5.7.0.18005, time stamp 0x49e01e60, faulting module php5ts.dll, version 5.3.5.0, time stamp 0x4d24d421, exception code 0xc0000005, fault offset 0x000915f5, process id 0xa0c, application start time 0x01cbdc073a834083.
Here's what I have done.
- I installed php 5.3.5
- copied php5activescript.dll (5.2.7.7) in the php folder
- regsvr32 php5activescript.dll (successfully)
- found and changed registry key [HKEY_CLASSES_ROOT\CLSID\{CF108A38-59A9-468A-AF45-1368D7855DAE}\InprocServer32] to point to php5activescript.dll not regsvr32.exe. (from http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/d7fb1088-5896-48db-9db8-43739feceaee)
Any thoughts?
|
|
|
|
|
Hi,
I am interested in knowing more about this design methodlogy to program an application.
Do not know how u call this structure but it is use to design an application. I am sure it is a popular design methodology since it helps project development. I hope someone recognizes to steer me in the right direction to learn more. tx
Hooks
if ($h->pageName == 'login') { $h->pageTitle = 'Welcome login to your Account'
$h->currentUser->loggedIn
----
Comments
<?php
/**
* name: Hello World
* description: Sample Plugin Tutorial
* version: 0.1
* folder: hello
* class: hello
* hooks: ....
A newbie might see above as comment. But these comment are use. For example name being Hello World for that is the plugin folder name. Class actually usage of the word Hello is a required syntax for that plugin Hello (please note class hello in the comment area). tx
Class hello
{
public function theme_index_top($h)
....
--------
Template, Plugin that can redefine some core code, etc.
Any info appreciated on this design methodology. tx
|
|
|
|
|
I am in a situation where I need to manage files that multiple users won't rename. I think I can use PHP to make each entry into a database unique by adding a unique tag to the file name but I don't know how to do this. The file name would need to be updated before it was entered into the database and the dump folder. Any suggestions?
|
|
|
|
|
why dont
you create a database entry for each file then use the primary key of the database item to rename the file.
//get uploaded file
//create database entry //name //type ... what ever fields are relevent
//get last insert id returns last primary key inserted
// rename file to $last_insert_id.xyz rename( old file, last insert id )
th
|
|
|
|
|
We deploy php applications on windows and linux. What are the consideration which we should follow in development so that the application run well on both the platforms.
|
|
|
|
|
|
In my experience when I had to host on a windows box because of the database we were using, I found IIS6 a nightmare!! The connection would fail, Permissions would change on upload and the whole set up was a nightmare. It took over a day just to get the site live and although there were some good forums on how to get php going on IIS, the reliability left something to be desired.
IIS 7 may be better but IIS work well with php. I would definitely run on XAMPP for a simple setup or install apache by itself. It was simple to install and I never had a server outage or drama in over 18 months. For consistency between the platforms IIS is the way to go.
The other thing to note is that some php modules that are easy to get going on debian like and cent os systems can be more tricky to get going on windows. A commonly used php module is imagemagick. File paths with windows can sometimes be a pain too.
|
|
|
|
|
Alright, I've got a small project from a guy who wants me to pass a variable from a form on one page to a form in an iframe on another. The page in the iframe uses GET to pass variables through the url.
The page in the iframe is here.[^]
The form on the other page takes the zip code and insurance plan choice and so should skip the entry step on this page, giving that information to the form. I'm not sure if I can just skip the entry page altogether, cause there's a link that uses the same page with the iframe.
They're using wordpress as well, so the server-side code would be in PHP if I would need to use anything besides html form code and javascript. Though I can't really add any PHP code inline with the wordpress editor. If I could find the page it creates with the iframe, I could edit it directly..
If you need any more information, please ask.
|
|
|
|