How do I link php slim with IonicHow can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error

What does it mean to describe someone as a butt steak?

Rock identification in KY

Convert two switches to a dual stack, and add outlet - possible here?

Replacing matching entries in one column of a file by another column from a different file

Is it unprofessional to ask if a job posting on GlassDoor is real?

How can I make my BBEG immortal short of making them a Lich or Vampire?

meaning of に in 本当に?

Watching something be written to a file live with tail

Why can't we play rap on piano?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Is it possible to run Internet Explorer on OS X El Capitan?

What's the output of a record needle playing an out-of-speed record

How do I deal with an unproductive colleague in a small company?

How is it possible to have an ability score that is less than 3?

A case of the sniffles

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

What would happen to a modern skyscraper if it rains micro blackholes?

How much of data wrangling is a data scientist's job?

Why can't I see bouncing of a switch on an oscilloscope?

Languages that we cannot (dis)prove to be Context-Free

Malformed Address '10.10.21.08/24', must be X.X.X.X/NN or

Can I make popcorn with any corn?

DC-DC converter from low voltage at high current, to high voltage at low current

Can a vampire attack twice with their claws using Multiattack?



How do I link php slim with Ionic


How can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
























  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13


















1















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
























  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13














1












1








1








this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?







php ionic-framework slim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 2:02







Patrick Sharma

















asked Mar 9 at 1:03









Patrick SharmaPatrick Sharma

62




62












  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13


















  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13

















Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

– domdambrogia
Mar 9 at 1:08





Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

– domdambrogia
Mar 9 at 1:08













Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

– Patrick Sharma
Mar 9 at 1:54





Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

– Patrick Sharma
Mar 9 at 1:54













Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

– domdambrogia
Mar 9 at 2:08





Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

– domdambrogia
Mar 9 at 2:08













I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

– Patrick Sharma
Mar 9 at 3:13






I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

– Patrick Sharma
Mar 9 at 3:13













1 Answer
1






active

oldest

votes


















0














After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



You should be able to do one of two things:



You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



php -S localhost:8080 -t public public/index.php


If you run php --help you can see all of the flags available with the php binary.



php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



    You should be able to do one of two things:



    You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



    Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



    php -S localhost:8080 -t public public/index.php


    If you run php --help you can see all of the flags available with the php binary.



    php --help
    ...
    -S <addr>:<port> Run with built-in web server.
    -t <docroot> Specify document root <docroot> for built-in web server.
    ...





    share|improve this answer



























      0














      After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



      You should be able to do one of two things:



      You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



      Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



      php -S localhost:8080 -t public public/index.php


      If you run php --help you can see all of the flags available with the php binary.



      php --help
      ...
      -S <addr>:<port> Run with built-in web server.
      -t <docroot> Specify document root <docroot> for built-in web server.
      ...





      share|improve this answer

























        0












        0








        0







        After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



        You should be able to do one of two things:



        You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



        Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



        php -S localhost:8080 -t public public/index.php


        If you run php --help you can see all of the flags available with the php binary.



        php --help
        ...
        -S <addr>:<port> Run with built-in web server.
        -t <docroot> Specify document root <docroot> for built-in web server.
        ...





        share|improve this answer













        After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



        You should be able to do one of two things:



        You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



        Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



        php -S localhost:8080 -t public public/index.php


        If you run php --help you can see all of the flags available with the php binary.



        php --help
        ...
        -S <addr>:<port> Run with built-in web server.
        -t <docroot> Specify document root <docroot> for built-in web server.
        ...






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 at 22:46









        domdambrogiadomdambrogia

        8111022




        8111022





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme