In php is it possible to get a website's root directory using ftp details?
Using ftp_nlist() function it displays all directories.I want only the root directory.
No. The FTP server doesn't know that - the web root directory is something that only the web server knows, and the FTP server isn't in communication with that.
Related
I want to move moodle lms from local server to live server, I moved moodeldata to httpdocs and tired to figure out httpdocs directory path on shared Linux based Plesk server. I appreciate any one helps me!
I tried like this
$CFG->dataroot='\httpdocs\moodledata';
but the result is
Fatal error: $CFG->dataroot is not configured properly, directory does
not exist or is not accessible! Exiting.
On Linux, they should be forward slashes
$CFG->dataroot = '/moodledata';
Also, its a really bad idea to put the data root in a web directory (httpdocs) that's publicly available - put the data root in a directory that's outside of the web root
https://docs.moodle.org/401/en/Installing_Moodle#Create_the_.28moodledata.29_data_directory
If you are migrating, then you probably need to backup the old data root too
https://docs.moodle.org/401/en/Moodle_migration#Copy_moodledata_from_the_old_server_to_the_new_server
Thanks all for your help! And now I changed as
$CFG->dataroot ='/data/www/example.com/moodledata'; then
I moved moodledata from httpdocs to home-directory and it worked correctly.
I try to set up a server in AWS
I have 2 folders in the www Folder of the apace server.
www/userdata
www/WebContent
How do i have to set the file permissions for the WebContent folder.
I think when the server is serving the php page it doesn't allow the php page (php script) to fetch the data from the /userdata folder.
So the pages in the webcontent server are readable by everyone.
The /userdata folder is not readable by everyone.
The php page gets the date from the /userdata folder just when the /userdata folder is readble by everyone.
This is my fist time trying to set up a server without vs code.
How do i have to set the permissions or group or what ever to get this work.
Thanks for the answers.
benni
the solution was to set the document root of the apache server to /WebContent
now just the server side script can access the userdata because on the other hand only the document root can be accessed from outside. The date is not accessible from outside but the php page is.
Bye
Benni
I want to access CodeIgniter system folder on another server securely via SFTP. I was able to connect to the server but the path to application and system folder could not be read in the index.php file on my local server.
It usually resides in the application folder. See their website or this tutorial for further information.
You need to change your application folder path like this :
$application_folder = "/Path/to/your/application";
In php there is any method to get a separate website's root directory?I know only the ftp details of the website.In my program i want to login to the ftp server using ftp details and create a folder in the website's root directory.For that I want to know the root directory of the website.Using ftp_nlist() it shows all directories.From that i want to identify which is the root directory of the website.How can i do this?
These are the steps in my script
Login to the ftp server using ftp_connect() and ftp_login()
Fetch the website's root directory
create a folder in that directory
You mentioned that you have access to FTP, thus you can use this line to find out the absolute path of the index.php:
$directory = dirname($_SERVER['PHP_SELF']);
I have a Flex-Page which connects to a MySQL-DB through PHP (Zend). I run the Flex-Page on an IIS-Server (Windows Server 2008 R2) and it works. But the problem is, that i specified the web root to the C:\inetpub\wwwroot directory (there php is running). On the server i want it on another directory. (Now i have the main Flex Page in the directory für the webserver, and the php files are in the wwwroot directory).
When i specify the web root to an other directory, nothing works, not even on my local machine.
I hope you know what my problem is.. ^^ (sorry for my bad english)
Thanks in advance!
You'll need to set up a virtual directory on IIS if you want your files served from other than the web root. So google "IIS virtual directory add".