I have just created a simple REST Api following this small video using Slim Framework 3.x. I was just getting started and I followed the instructions in the video and created a simple route like this
$app->get('/', function($request, $response)
{
return 'Home';
});
This works on localserver (XAMP) when I open the link `
localserver/project_name/public/
` I get "Home" returned on the page.
After that I simply Zipped the project folder and uploaded it to my Web Hosting, htdocs folder. I extracted the zipped project, which included the "composer.phar" and "vendor" folder. I try the same thing again, i.e., I run the url
www.mysite.com/project_name/public/
All I've done is change "localserver" with www.mysite.com but the browser tells me that my domain
is currently unable to handle this request.
I know this might be something very obvious but I am a novice in php and REST Api's. So any help is appreciated. Also some things I think might matter are, The web hosting that I am using is Plesk based. I have a mysql database Running on the hosting and simple php files run when run individually. For example if I run simple call a test.php file with some database query in it and some echo, it will run successfully. Even if you can point me in the right direction, I would appreciate it. Oh, and I don't have access to php.ini on the hosting. I was only provided with one login that lets me login to the hosting and I can see htdocs folder among some others. I have attached an
image of the view I get after logging in, to give you more perspective of the type of hosting I have. I am hosting a website in the httpdocs directory as well. ASP.NET developed
I just need some direction as to what I need to do to be able to publish my REST api to my hosting and be able to access it through this android app that I am building. What do i need to do on my server? What settings to change to make the api work?
Related
As you can probably tell, I am new to Magento2 and I am trying to figure out some of the basics. I'm a full-stack developer that is use to developing (frontend and backend) myself then using docker and finally hosting it on an AWS:S3/EC2 or AWS: Elastic Beanstalk. With that said, Magento seems like a completely different beast to conquer.
I have a family member who is wanting me to do some basic frontend stuff for their website (such as changing Navbar design and a potential home page overhaul later on), naturally wanting to help them out I agreed to have a look and see what I can do. I have access to their Magento 2 dashboard area and have been looking around with no sure luck thus far. I have researched online that Magento 2 allows for a "Page Builder" or a "WYSIWYG" type functionality. But I am unable to use these types of tools because my family member had the website built by a Magento 2 developer firm awhile back and everything is coded manually and could cause problems if using one of the above mentioned tools. Due to this I am trying to get access to their site directory so that I can go in and make the necessary changes and upload the files. But I am really struggling on how to access the codebase.
I have read that an admin needs to send me the code??? Or grant me access to the code or something along those lines? I do have the host, port, root, username, password, etc. for the live server but still having trouble.
Any help would be greatly appreciated.
You need to use ssh to access the server
ssh user#host -p port
After you get into the server, you should set up a git repository in the project root and push the code from the server to the repository, then clone the repo to your local environment.
From there on, it's the normal development flow. You can use a clean database with sample data or you can dump the db from the live env and use it on your local env, but this will require some changes in the db after the import.
Detailing all the steps required to do this task would take forever and would cover a lot of different issues/steps.
"I have read that an admin needs to send me the code???"
Not sure what you mean by this, but a Magento admin is just a user on the backend side of the website. He does not have access to any code.
A git repository admin(probably previous dev) could grant you access to the code repository, but this doesn't seem like an option.
There is a running website (on Bitrix CMS) located on the simplest shared hosting with cPanel. The task is to create a standalone little web application in PHP (for internal use in the company), which, for simplicity, will be available from the same domain, but, what is important, it will not affect the already running site.
On the hosting, in the file manager, there is a public_html folder - as I understand these are the site files. I created in public_html a subfolder (for example, webapp) and added a couple of test files (for example, test.txt). The test file is supposed to be available at site.com/webapp/test.txt, but nothing is loaded - just a white screen, no error messages.
Trying with text files and simple php-scripts - the same result, just white screen.
How to fix it?
Check your .htaccess on site root, it maybe redirecting all routes to index.php of Bitrix CMS.
Alternatively you can follow above answer and create a subdomain.
Simple tutorial here.
You can create a subdomain and point your public_html folder there.
You need to create an Index.php file in the subdirectory, in hosting any folder must have this file which will be executed any time you access that directory with URL.
Was trying to play around with my brothers on this app, the goal of making this app is just for fun, not going to achieve anything on the security aspect, nothing much.
The last thing that I want to achieve is that I want to call a php file from my app.
From the tutorial I watched on youtube,
HttpWebRequest.Create(string.Format(#"http://192.168.0.101/load.php"))
This works fine as I call 'load.php' from my server(another machine on same network), then the file will establish the connection to an online database(freemysqlhosting), then the file will run some queries and display the return results on my app.
So my question is, what if I want to call the load.php somewhere but not from my server ?
Is it possible for the app to call the file directly from its directory ? Does app works in that way like php/c++ ?
Or must I buy some web hosting accounts to upload a single php file online so that my app can call it ?
You should load the PHP file from a server.
If you want to load a web server inside your app, first you have to code (or include) the web server code and then include the PHP binaries in your app for the architecture of your app
I am currently using AngularCLI to generate an app for me. When starting npm serve is starts its own server. However, i need to integrate PHP / MAMP and thus it uses it's own web server.
What is the best way to link the two? Very little info on Google but I am probably not searching for the right terms.
first of all, to host your app on a mamp-server you just need to:
ng build --prod
and then copy the files in the dist-folder to the root of your web-server.
But Im guessing that you then want to read and write from the database.
This is my recommendation:
Dont put php-tags in your html, make web-services
e.g. make php-scripts that get data from the database and outputs the as json, then use HTTP to get the data to your Angular-app.
Add root url (hostname) into build js links in index.html,index.html not understand to .css .js files in build folder in hosting time.
I don't know if it is even possible so that's why I put my question here.
We have a webserver running a PHP application build within the Yii-framework and we have also integrated Wordpress into that application.
The root contains the Yii-application and a dir with the wordpress installation. Now I would like to know if it's possible to create a page and have it a url outside it's installation dir.
An example:
domain.com shows the Yii application index
domain.com/blog shows the Wordpress homepage
Now I want to create domain.com/foobar and the page foobar comes from Wordpress.
Is it possible and how?
Kind regards,
Pim
Your server will have been setup with your domain name. I don't know if you are using a hosted service, or a cloud based option, but either way you should be able to tell your web server to load different index.php files based on the URL.
Every single web request comes through your web server. You can tell your web server to load different php files depending on the http request URL.
For example, when you setup your sever with domain.com you would have had to (or in most cases its the default) tell your web server to route all domian.com requests to /public/index.php
Following this logic, if you want to load a different index.php file from a different URL, you just have to set this up in your web server. So domain.com/foobar would point to /some/directory/public/index.php
The way you do this very much depends on your server and if you have some server admin software installed e.g. cPanel.