Page 1 of 1
PHP includes path issue in child directory
Posted: Fri Nov 15, 2013 9:42 am
by berkhort
I have an issue where files in the parent directory are rendering as they should, but files in a child directory are showing errors such as this:
Warning: include(includes/header.php) [function.include]: failed to open stream: No such file or directory in /nfs/www/WWW_pages/berkhort/berkeleyhort.com/gardening-suggestions/13-1112/index.html on line 7
The path seems to go beyond the parent directory for the site.
Does anyone have an idea why this is happening or how to resolve it? Sonic techs could not.
Here is the site to see:
http://berkeleyhort.com/gardening-sugge ... index.html
Thank you!
Re: PHP includes path issue in child directory
Posted: Fri Nov 15, 2013 5:41 pm
by cdkeen
I presume you have resolved this issue as the link provided does not throw the error reported. Please respond if you need additional assistance.
Thanks for choosing Sonic.net!
Re: PHP includes path issue in child directory
Posted: Sat Dec 14, 2013 1:18 pm
by doisneau
Hello,
I had a similar problem with php pear mail.
After modifying the configuration (
https://wiki.sonic.net/wiki/Php5):
copying the php.ini in my web domain directory i have another error:
Fatal error: Class 'Mail' not found in /nfs/www/WWW_pages/...
I could not find the Mail.php file in the /opt/php53/... directories
I use PEAR:
require_once 'PEAR.php';
$params["host"] = "mail.sonic.net";
$param['sendmail_path'] = '/usr/lib/sendmail';
$backend = 'sendmail';
$mailObj = &Mail::factory($backend, $params);
$result = $mailObj->send($sendTo, $headers, $body);
Any idea on how to solve it?
thank you
doisneau
Re: PHP includes path issue in child directory
Posted: Mon Dec 16, 2013 1:36 pm
by cdkeen
You will need to manually include the file you are attempting to require_once :
$ wget
http://download.pear.php.net/package/Mail-1.2.0.tgz
$ tar -xzf Mail-1.2.0.tgz
$ mv Mail-1.2.0/Mail.php /path/to/your/public/site
Reload your php file and see if the error is resolved. Let me know if you require further assistance!
Re: PHP includes path issue in child directory
Posted: Wed Dec 18, 2013 2:16 pm
by doisneau
Hello and thank you for your suggestion.
I placed the Mail.php in the domain directory unchanged.
I added inside the php script: require_once '../Mail.php';
I got a different error about PEAR_Error::send() I fixed it by using: if (PEAR::isError($mailObj)) {
now I don't have any error, it returns to a different page but no mail has been sent.
Is there a way to trace the mail sending process?
parameters of my script:
$params["host"] = "mail.sonic.net"; // The server to connect. Default is localhost
$params["auth"] = "PLAIN";
/* use either sendmail or smtp: */
$param['sendmail_path'] = '/usr/lib/sendmail';
$backend = 'sendmail';
$mailObj = &Mail::factory($backend, $params);
thank you
Re: PHP includes path issue in child directory
Posted: Thu Dec 19, 2013 12:09 am
by doisneau
Hello,
I did not resolve the previous post: I never received the mail I sent to myself thru this feedback.php script ...but I did not have any error! beautiful!
Now I am closer to the aim as it is really trying to read that script but with errors.
-0- I followed the instructions on the page:
https://wiki.sonic.net/wiki/Php5
-1- the php script is in my public_cgi/sc/feedback.php
(note this public_cgi is not under my domain/ directory structure but above (is it right?).
Because of errors I placed also the sc/ into the deco/ director, but to no avail.
-2- in the html page the request to that script is in the form:
action="sc/feedback.php"
-3- in the .htaccess located under the domain/ directory:
I have: Action php-cgi public_cgi
I tried other path structure: using my SONIC username but always an error.
I get the following error:
Invalid URI in request POST /deco/sc/feedback.php HTTP/1.1
Thank you for your suggestions
Happy holidays
doisneau
Re: PHP includes path issue in child directory
Posted: Thu Dec 19, 2013 4:11 pm
by cdkeen
I added some files and a form for you to try and see if it fits your needs. I adapted it from a form I wrote some time ago which used PEAR as well. I downloaded the files needed from pear.php.net and added them to the includes dir in the web root for the site and the form is in the file contact.php. If you need additional assistance please send me an email off list (just to
[email protected] and ask them to deliver it to cdkeen in ops) and I will do my best to assist you and answer any additional questions you may have. Thanks for choosing Sonic.net!