How to launch PHP on Atom? - php

While changing file from .html to .php extension it shows me message that there is no PHP interpreter found at php. And it is not about script support it is should launch on the browser. Clicking the "the set PHP" button it shows me the ide-php package. And I see no way how to set the Path.
Atom settings.PHP settings

you cant run php without a server, you need to install XAMPP (in case of windows you could use WAMP or in case of mac you could use MAMP).
you can download XAMPP from the link below:
https://www.apachefriends.org/download.html

Related

Issues when using PHP server in Visual Studio Code with Laragon

I am doing a Full Stack web developing course and I wanted to use the PHP Server extension for Visual Studio Code with Laragon serving as the virtual server. Problem is, when I right click on a .php file on VSC and try to "serve" it, the URL turns into something like this: localhost/laragon/www/IntroduccionPHP_POO_Inicio/namespaces.php, which yields a 404 error page.
If I remove the /laragon/www from the url so it looks like this:
http://localhost/IntroduccionPHP_POO_Inicio/namespaces.php, it works (I mean,
the .php file is loaded correctly) but PHP server doesn't update my page
automatically anymore.
I need to know if there is a way to tell PHP server to ignore the
/laragon/www path. Maybe some configuration that I am not aware of?
Btw, the php files I want to load with PHP Server are added to the VSC
workspace with their full path, which is c:\laragon\www. I don't know if that
is the problem and if so, how to solve it.
You should try to install MAMP or XAMPP instead of this. It will be more helpful. ;-)
MAMP : https://www.mamp.info/en/downloads/
XAMPP : https://www.apachefriends.org/index.html

my "phpinfo.php" file loads a completely blank page in both firefox and safari [duplicate]

This question already has answers here:
PHP code is not being executed, but the code shows in the browser source code
(35 answers)
Closed 7 years ago.
Background: I want to learn PHP and in the tutorial that I'm doing, one of the first things it has you do after getting PHP and mySQL going is to to test it by making a phpinfo.php file and opening it.
Problem: In FireFox, the file loads a blank page. In Safari it only shows the code that I wrote: <?php phpinfo(); ?>.
Steps so far (not necessarily in order):
I followed the steps at http://coolestguidesontheplanet.com/how-to-install-php-mysql-apache-on-os-x-10-6/
I have made a phpinfo.php file using text editor in plain text mode (as opposed to rich text) and saved that in my "sites" folder. This is the only line in that file:
<?php phpinfo(); ?>
In system preferences, I have web sharing turned on and mySQL server running. I have removed the # from in front of the load php 5 module line in the httpd.conf file as per the tutorial I mentioned. I've tried restarting the web server using "sudo apachectl restart" and then restarting Firefox.
I looked for a php.ini file in my etc folder. There wasn't one but I did find a php.ini.default. I duplicated that file and renamed the duplicate to php.ini. I'm not sure this step was a correct step to take but from the little I could find on the internet it looks like somebody else has done this and I thought, why not?. (phpinfo.php loaded a blank page before and after this step)
I typed php -i | grep php.ini into terminal and got the following:
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /private/etc/php.ini
and a timezone warning
So I decided to look for a php.ini in the /private/etc folder and there is one there. ( The one I created was in the /etc folder not the /private/etc folder.)
I have searched the internet including this website for answers.
System info:
When typing php -v into terminal it tells me that I am using PHP 5.3.28
When typing mysql -v into terminal it tells me that I am using mySQL 5.6.10
I am running Mac OS 10.7.5 on a Macbook Pro.
FireFox version: 40.0.3
Safari version: 6.1.6
Questions:
1) Did I correctly create the php.ini file?
2) What am I missing? Why is the phpinfo file not loading in my browser?
3) Is the timezone warning important?
Make sure that your source code file has the .php extension in the end.
If you can see the code of your php file in your browser, probably your apache server is not started or it is not working properly. To set your development environment quickly, I recommend that you download an "all in one package" such as XAMPP server or WAMP server. It comes with everything that you need to get your php project working and it is very easy and quick to install.
Take a look at: https://www.apachefriends.org/index.html
Once you have installed the package, create a folder for your project and put your php file inside it. So, copy your project folder to "htdocs" folder, inside the WAMP or XAMPP path, open your browser and type the URL:
http://localhost/yourProjectFolder/phpinfo.php
You shall see your php file working on.
Good luck!

Apache downloads PHP files instead of displaying in browser when called via CMD (Ubuntu)

I've installed LAMP on my Ubuntu laptop with no apparent problems and successfully did the phpinfo() test by navigating to the file through the browser. But the same file is downloaded instead of executing when I'm trying to build from Sublime Text 3 using the following script:
{ "cmd": ["/opt/google/chrome/google-chrome" ,"$file"] }
That worked the first couple of times I tested it, but stopped right after I changed the name of the build system and hasn't been functioning since even after I reversed the change. How would I go about fixing the issue?
$file is "The full path to the current file, e.g., C:\Files\Chapter1.txt.".
Apache isn't causing the file to be downloaded; you aren't requesting it from Apache.
You need to translate $file into a URL on your HTTP server.

Cant add PHP 5 Interpreter on Netbeans

I'm currently trying to add the Codeigniter framework to Netbeans. I followed all instructions to download the plugin as noted here : https://kenai.com/projects/nbphpci/pages/NBInstall , but after all is done and Netbeans is restarted, I try to create a new project but an error comes up saying
PHP Interpreter must be selected
I tried pointing it to my php.exe file found in my WAMP directory C:\wamp\bin\php\php5.3.13\php.exe but still nothing... any ideas? I attached an image where the error shows (in the options window)
You have to localize the php.exe file.
If you are using xampp it is located in c:\xampp\php\php.exe
In case you are using wamp it is located in c:\wamp\bin\php\php.exe
If you see the message above you have to...
Download xampp latest version from http://www.apachefriends.org/en/xampp.html.
After you run netbeans, you get the error message above you should
click the "Browse" button.
Go to xampp folder for example C:\xampp
Click on PHP folder C:\xampp\php
Click on php.exe to tell neatbeans the interpreter directory location. (because it does not come with netbeans package) xampp\php\php.exe
Run Netbeans as administrator
So you can set your path in the php setting

call to undefined function curl_init() in .bat file

I created my php file as .bat file using
#ECHO OFF
php -f D:\wamp\www\scrapper\scrapper5.php
I used cURL in scrapper5.php, when i run .bet file manually i got and error
call to undefined function curl_init() in your file
I researched and i got cURL is not working in CLI mode.
I just follow below step but can't get success.
Run a php script as a background process in wamp server
How can i run batch file with cURL?
Can anybody give me solution?
From the error you have posted, it looks like you do not have cURL installed. Perhaps look at you CLI config for PHP and see if the curl module is active
Wamp may not have cURL installed by default - have a look at options for installing it on your system.
If i remember correctly, you should have a menu (right click on the wamp icon) for enabling/disabling apache modules. Have a look there for cURL and enable it. (sorry if this is a bit vague, I'm on a mac at the moment and on Windows it has been several years since I moved form WAMP to XAMPP)
If that doesn't work, some forums seem to mention downloading the cURL extension (on windows this is a .dll file) from here: http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/ and putting that in your ext folder under the WAMP instal directory. Just make sure to get your versions correct to ensure stability.
I think you have to enable cUrl feature in wamp server. Follow those steps may it will help you:
1. Go to wamp Server Tray icon which is placed in the task bar.
2.Open PHP Tab.
3.PHP Extensions.
4.Then make sure PHP_CURL is selected.
5.Then restart wamp server.
I hope it will help you!!!!

Categories