Is it possible in, say, a .htaccess file, to append additional paths
to the php include_path without knowing what the value of include_path
is beforehand? I want to add an absolute path to a directory and it's
subdirectories from a .htaccess file, but I don't want to have to
encode the entire current value of it and append my own path as that
would mean having to change it every time it changes in php.ini or the
code is deployed on a different server. 4 3817
Gordon wrote:
Is it possible in, say, a .htaccess file, to append additional paths
to the php include_path without knowing what the value of include_path
is beforehand? I want to add an absolute path to a directory and it's
subdirectories from a .htaccess file, but I don't want to have to
encode the entire current value of it and append my own path as that
would mean having to change it every time it changes in php.ini or the
code is deployed on a different server.
I suppose everyone works differently. I always have a site config file
that I include on every page. This has all the site or project specific
paths and functions in it. I usually put the database handle in this
also. That way when I want to move this code to a new server or domain,
I just change the paths and the database settings in this common config
file.
Jeff
On Aug 1, 9:57 am, Gordon <gordon.mc...@n tlworld.comwrot e:
Is it possible in, say, a .htaccess file, to append additional paths
to the php include_path without knowing what the value of include_path
is beforehand? I want to add an absolute path to a directory and it's
subdirectories from a .htaccess file, but I don't want to have to
encode the entire current value of it and append my own path as that
would mean having to change it every time it changes in php.ini or the
code is deployed on a different server.
AFAIK, no.
However, you could set an auto-prepend in the htaccess file which
reads the current value and then sets a new value including the
original.
Personally, I usually go with having a standard lib required in every
file which searches the current dir then up through the dir hierarchy
till it finds a file with a particular name (e.g.
'ht_php_conf.in c.php') and requires it if found. The overhead for this
is surprisingly small compared with requiring a file with a pre-
declared path.
C.
*** Gordon escribió/wrote (Fri, 1 Aug 2008 01:57:59 -0700 (PDT)):
Is it possible in, say, a .htaccess file, to append additional paths
to the php include_path without knowing what the value of include_path
is beforehand? I want to add an absolute path to a directory and it's
subdirectories from a .htaccess file, but I don't want to have to
encode the entire current value of it and append my own path as that
would mean having to change it every time it changes in php.ini or the
code is deployed on a different server.
You can always do it in PHP itself:
<?php
echo 'Before: ' . ini_get('includ e_path') . "\n";
include('file_i n_foo.php');
ini_set('includ e_path', ini_get('includ e_path') . ';C:\\Foo');
echo 'After: ' . ini_get('includ e_path') . "\n";
include('file_i n_foo.php');
?>
If you don't have a general configuration file in your site where you can
place this stuff, you could even use the auto_append_fil e PHP directive to
automatically include a script.
Just make sure you don't get lost; it happens pretty often with automagic.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ramprasad A Padmanabhan |
last post by:
I know it is a dummies question, But I am not able to find it on the php
manual. Can anyone tell me How to set the include_path in php
thanks
Ram
|
by: mirko |
last post by:
Hello,
I have a problem with my include_path and I don't know why... Can
anybody see the mistake?
my configuration:
PHP Version 4.3.11
System: Windows NT 5.0 build 2195
|
by: Paul |
last post by:
I am taking over an existing app and having trouble understanding their
references.
They have encapsulated Pear packages in the directory structure like:
/site
/site/html/Pear.php
/site/html/Sigma.php
/site/html/Common.php
/site/html/Quickform.php
/site/html/Quickform/
|
by: Schraalhans Keukenmeester |
last post by:
I suspect the following problem IS hosting provider specific, but they
haven't been able to help me out so far. Perhaps I am doing something
wrong and someone is able to spot the issue... Here goes.
The actual path of the root dir of my account with hosting provider
(H.P.) is:
/usr/local/psa/home/vhosts/mydomain.com/
The webroot is a subdir of the root:
/usr/local/psa/home/vhosts/mydomain.com/httpdocs.
Include files go in:
|
by: Bastien Continsouzas |
last post by:
I am trying to set the include path for SimpleTest under Eclipse
I have the following config :
Eclipse : 3.2.0
PHPEclipse 1.1.8
SimpleTest plugin : 0.2.1
I ran a test I found on the SimpleTest plugin page and it worked fine
http://simpletest.org/en/extension_eclipse.html
| |
by: Charles Crume |
last post by:
Hello Everyone;
My site was hacked the other day -- someone was able to rename my
index.shtml file and put their own index.html file on my server. Not sure
how it was done, but looking through the log file, I found a lots and lots
of entries where an "include_path" parameter was included in the URL of the
PHP page, as shown below:
69.94.36.155 - - "GET...
|
by: Rob Wilkerson |
last post by:
Hey all -
I'm trying to create a developer-friendly environment on my production
server. By that, I mean an environment where developers don't need to
worry about certain things. Among those is the include path. I have
a "core" include_path set in php.ini, but most projects will require
an include path of their own _in addition to_ the global
include_path. Ideally, I'd like to script this directly into the
virtual host configuration...
|
by: hoobert |
last post by:
Hi all -- I have an include_path question.
Just setting up a new server, and I'm running into a really stupid issue.
I have the following line in php.ini:
include_path = ".:/usr/local/include:/usr/share/pear"
Inside /usr/local/include there's a file lib/html/html.php which does some templating for me.
|
by: mukeshrasm |
last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini include_path. If you are using the SMTP mailer then place class.smtp.php in your path as well", but I don't know where to paste the class.phpmailer.php into my php.ini include_path. In my php.ini file the include path is commented and it is like
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |