LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-27-2019, 11:58 AM   #1
shams
Member
 
Registered: Jan 2004
Posts: 537

Rep: Reputation: 30
please give the right path for the php files?


All the dropdown php files are in the dropd directory, these are the files:
Code:
http://example.com/dropd/2c-ajax-geo.php
http://example.com/dropd/3a-index.html 
http://example.com/dropd/lib/2a-config.php
http://example.com/dropd/lib/2b-lib-geo.php
http://example.com/dropd/public/3b-demo.js
http://example.com/dropd/public/3c-demo.css
I should give the right paths in these files to connect to the mysql database:
path in the file lib/2a-config.php:
Code:
// PATH
define('PATH_LIB', 'ABSOLUTE PATH HERE')
Path in the file 2c-ajax-geo.php:
Code:
// (1) INIT
require __DIR__ . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "2a-config.php";
require PATH_LIB . "2b-lib-geo.php";
The Path for the file 2c-ajax-geo.php in the file public/3b-demo.js:
Code:
xhr.open('POST', "PATH/2c-ajax-geo.php")
This is what i did but cannot connect to the database:
path in the file lib/2a-config.php:
Code:
// PATH
define('PATH_LIB', __DIR__ . '/lib');
Path in the file 2c-ajax-geo.php:
Code:
require __DIR__ . "/" . "lib" . "/" . "2a-config.php";
require "/lib/" . "2b-lib-geo.php";
The Path for the file 2c-ajax-geo.php in the file public/3b-demo.js:
Code:
xhr.open('POST', "/2c-ajax-geo.php", true);
 
Old 08-28-2019, 02:36 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
It would be helpful if you post the error messages that show. At first glance I think that this
require "/lib/" . "2b-lib-geo.php";
cannot work and should be replaced by
require "./lib/" . "2b-lib-geo.php";
or
require "./dropd/lib/" . "2b-lib-geo.php";

But without error message this is just a shot in the dark...
 
Old 08-28-2019, 01:25 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,752

Rep: Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223Reputation: 2223
^ yes
The config files want the path as seen on disk, not as the browser sees them.
Please post the error(s) you're getting.
 
Old 08-28-2019, 01:42 PM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
The require searches an absolute path as scasey says or a path from the include_path setup in the php.ini. Some hosters setup the include_path in a way that it matches the document root of the domain. But you should not rely on that. But you can run within a php file:

echo get_include_path();

This will tell you about the settings.
 
Old 08-28-2019, 07:53 PM   #5
shams
Member
 
Registered: Jan 2004
Posts: 537

Original Poster
Rep: Reputation: 30
Thanks for replies, there was one error for the permission, and these paths solve the problem:
Code:
// PATH
define('PATH_LIB', '/lib')
require __DIR__ . '/lib/2a-config.php';
require __DIR__ . '/lib/2b-lib-geo.php';
xhr.open('POST', "2c-ajax-geo.php", true);
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Perforce edits my files when I give a depot path but not if I specify the local path gregorian Linux - Software 1 10-21-2011 11:57 AM
Perforce edits my files when I give a depot path but not if I specify the local path gregorian Linux - Software 1 10-07-2011 05:03 PM
Please give the right choice about the multi-choice question! keika Programming 1 07-22-2009 04:20 AM
Does anyone knows how to give path in linux on C files utkarshrawat Linux - General 3 09-28-2007 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration