How to get all domains on server using PHP? - ip

Im working on a small php script and i want to add a feature that allow visitors to get all domains hosted on a server . But i don't know how to do it with php .

You do not tell many details...
Try system("ls /var/www/directory/with/domains")
Of course, you must have privileges.
I do not know if I understand your problem.

Related

Switch host from localhost/website to website/ Symfony URL

I'm sorry if this question seems to be stupid...I've just forgot how to do that.
If my main URL is : http://localhost/Website/web/app_dev.php/
I would like to access the same page with the URL Website/
I remembered it were about hosting so I've just add 127.0.0.1 website to my hosts file and now I can access with the URL http://website/Website/web/app_dev.php/
But I still miss something to get what i want...i just can't remember where I have to go, I think it's not really and directly Symfony related problem. Have you an idea ? Thanks a lot
If you are using the builtin server (bin/console server:run or start) then you have to specify the port also (http://localhost:8000/Website/web/app_dev.php/)
In fact I figure it out, it was the file httpd_conf from apache i was looking for. It's all fine now. Sorry for your time.

Drupal 8 Redirects to external URLs are not allowed by default

I am setting up a website with Drupal, the website is deployed on the live server through bitbucket pipelines. Normally when I browse to myurl.com/user it redirects me to myurl.com/user/login however now I get this error:
Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.
I have already set-up the "trusted_host_paterns" however this doesn't seem to fix the problem.
trusted host patterns:
$settings['trusted_host_patterns'] = array(
'^myurl\.com$',
);
Just in case somebody else comes here: It is also possible, that you have migrated a multi language site to a different server / localhost, and in your database are still the old redirect domains, that will now no longer work.
To fix this, you need to manually change the following value in the database. Go to dr_config and search for language.negotiation
In the cryptic blob, search have a look for something like
{s:6:"source";s:6:"domain";
and change it to
{s:6:"source";s:6:"path_prefix";
afterwards empty all cache_* tables (to force a reprocessing of the configuration) and there is a good chance it might work then.
The pattern seems OK to me. However there is what I'd check:
Confirm using your browser that the redirect to /user/login happens to exactly myurl.com domain. Not www.myurl.com for example.
Try clearing cache as well.
Then looking through this post on DO
And then this one. It's a D8 issue not fixed yet.
I remember having a similar issue on one of my websites during development on a local environment and the issue was really in the pattern.
In the case you have this because of a multilingual site not finding the domains on localhost, put in settings.php:
$config['language.negotiation']['url']['domains']['en'] = 'my-en-url.localhost';
$config['language.negotiation']['url']['domains']['de'] = 'my-de-url.localhost';
$config['language.negotiation']['url']['domains']['es'] = 'my-es-url.localhost';
$config['language.negotiation']['url']['domains']['fr'] = 'my-fr-url.localhost';

Requested site does not appear to have claims enabled or the Login Url has not been set

i am currently getting information from my company's sharepoint page and display it on my asp.net project. I am using ClaimClientContext for authentication, and of course in my local host it is working fine.
However, when I publish the site and place it on my server the following error occurred: The requested site does not appear to have claims enabled or the Login Url has not been set.
The error is pointing to the Url which i have stated in my code:
Using ctx As ClientContext = ClaimClientContext.GetAuthenticatedContext("https://abc.sharepoint.com/team/Wiki/")
Any idea on how I can overcome this error? Do let me know if more information is needed, and i will gladly provide. Thank you.
Ok. After struggling with this for quite a bit now, I was able to resolve the issue. Its something to do with oAuth2 not supporting old protocols.
You can resolve with the below power shell commands
Connect-SPOService -Url https://<yourdomain>-admin.sharepoint.com -credential <adminIDwithElevatedPrivileges>
Set-SPOTenant -LegacyAuthProtocolsEnabled $True
You might have to wait for sometime after running this command.
Hope this helps!

Dreamweaver CS6 Site Setup for Test Site with MAMP and WordPress NIGHTMARE

I have been trying to set-up a test site server on Dreamweaver CS6 IDE (which I hate) to try out the Dynamically-related files theming feature. I have been attempting to do this for hours and looked at more tutorials and blogs than I can remember attempting to set-up a test site so that I can simply try out this feature but nothing seems to work.
On the Site box I have:
Site Name: test site
Local Site Folder: users/myname/Sites/wordpress/
On the Servers I have:
Server Name: Apache
Connect using: Local/Network
Server Folder: users/myname/Sites/wordpress/
Web URL: http://localhost:80/wordpress/
Advanced:
Server Model: PHP MySQL
Yet I am receiving the an Error message:
Dynamically-related files could not be resolved because the site
definition is not correct for this server
Which makes no sense to me. Can anyone explain what am I doing wrong?
"i was under the impression that this feature would somehow convert PHP syntax into HTML so that it can be easily edited..."
What in God's name gave you that impression? PHP is server-side scripting; a way for the browser to communicate with the server and database and HTML is a way for the browser to communicate with the client (you) and render things in a form which is usable by humans. There is no "conversion", as they are two universally different languages, each serving unique functions.
In order to "easily edit" PHP, the only solution is to learn PHP scripting and syntax.
MAMP's sole purpose is to install an Apache server, PHP, and mySQL on your local computer for a server-side/database framework, such as WordPress, to store information and communicate with. Essentially like creating a mini web-host on your local machine, allowing you to check the functionality of PHP based applications.
These setting are working for me:
Open the Dreamweaver Site Setup window
Select "Servers"
Server Name: localhost
Connect Using: Local/Network
Server Folder: MAMP/ /Applications/MAMP/htdocs/your_directory_name/
Web URL: http://localhost:8888/your_directory_folder/
For a full explanation: http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html#articlecontentAdobe_numberedheader_2
I have come across the same issue and found this thread.
The post that explains a bit what we want to hear is post #6 by David_Powers on 01-May-2010 at 05:31.
So to make the problem go away you can go to 'Edit -> Preferences' and disable 'Discover Dynamically-Related Files' while leaving 'Enable Related Files' activated.
Although this fixes the error display I don't quite understand what David_Powers says this function will do and if I actually want it turned on. If someone could help me realize what this option does I would appreciate it.
I don't know if this is relevant, but after many tries to figure out the Server not found error, I stumbled across MAMP Preferences on the start up page.
After clicking on Preferences, I noticed that the Document Root was pointing to username/Sites instead of MAMP/htdocs.
MAMP Preferences > Document Root > browse to select
After I set the Document Root folder to htdocs, I finally got Dreamweaver CS6 to display my php file when I clicked the Live button in split screen mode.
None of the other answers I searched mentioned setting MAMP preferences to the Document Root folder. I hope this helps.

Moved Drupal 7 site to a different server, can't log in

I recently moved my Drupal 7 site to a new hosting server and I'm stuck at the login page. As soon as I try and log in, I get directed back to the same page, but the URL changes from /user to /user/1, which leads me to believe that I am actually logged in, but I'm not being forwarded to the correct page.
I tried cleaning my cache, emptying the cache tables in the DB but nothing helped.
Any ideas?
EDIT: To make things a bit more clear, I've used the specific server for various other Drupal 7 sites, so I know for a fact that the server configuration is not at fault here.
I suspect your $cookie_domain in /sites/default/settings.php is incorrect.
Try making it match your new domain and ensure there's a leading dot .
$cookie_domain = '.mydomain.co.uk';
Sometimes problems relating to logging in after a site migration can be because mod_rewrite was enabled on the first machine but not the second. A simple way to test this is to use the ?q= URL format (http://site.localhost?q=user) and see if you can log in like that. If that works then you can either disable clean urls from within the Drupal interface, or enable mod rewrite in Apache.
In my case the issue was solved only after refreshing .htaccess file in drupal root folder.
You can take the source here: https://github.com/drupal/drupal/blob/7.x/.htaccess
seddonym's comment about mod_rewrite led me to a slightly different solution. I was having the same problem but was able to solve it by copying the file rewrite.load from /etc/apache2/mods-available to /etc/apache2/mods-enabled.
I think the files in mods-enabled are some sort of link files (I am novice at linux still) but copying the files worked just fine. Maybe someone will come along and tell us the proper way to do this.
Sometimes all you need is to clear the cookies for the domain/website - it's possible you have old cookies alive that are causing this.
Get a cookie manager to help simplify this, e.g.:
Edit This Cookie (for Chrome)
Other answer might be that rewrite php module is not installed, to do that do the followings:
sudo a2enmod rewrite
Restart apache2
sudo service apache2 restart
In my case it was very stupid, on my page.tpl.php, there wasn't any "content" and the page--user.tpl.php didn't get read. Only had the line to show content in the page.tpl.php
Although that it is unlikely that you're as stupid as me. ;) Maybe it will be helpful anyway.
Arne

Resources