I want to run my first php project in eclipse(with help of pet package). When I run my project (index.php) eclipse show an error with below message :
Page Login failed with error. Could not connect to the server.
More information :
When I enter "http ://localhost" in my browser it couldn't find server
I'm using kepler version of eclipse
I'm run eclipse in MAC OSX
I think my local server didn't start or I haven't local server. How can I solve this error? How can run local php server in mac ?
Best Regards
You need to install a server package, something like MAMP. Then you need to configure it in order to be driven by Eclipse, using Xdebug, which is a module for Apache. In order to set up your configuration with Xdebug, take a look here: http://wiki.eclipse.org/Debugging_using_XDebug
Related
I'm new to Mac Environment. My colleague recently gave me a Laravel project that I had to work on with a new cosmetic changes.
Like usual I get all the files and do the typical things like git the project, install composer, install npm, database setup, .env file setup and run the project.
I can open the project on the landing page. But what happened was, when I tried to sign in, I failed to enter the homepage. When I check the console it says: View error Message
POST http://localhost/aplikasi-laravel/MY/user/login 500 (Internal Server Error) Jquery-3.1.1.min.js: 4
Request URL: http://localhost/aplikasi-laravel/MY/user/login
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: [::1]:80
Referrer Policy: no-referrer-when-downgrade
For your information, if I install and create a new Laravel project on this OS, it works. But I need to work on this project. So I have no choice.
My Project Specifications are as below.
Laravel: Laravel Framework 5.4.36
PHP: 7.1.28
MySQL: 5.7.26
So what I'm doing is I install MAMP, downgrade to PHP 7.1.31 (only this php version is available), try running the project. Still failed. So I uninstalled it.
I tried using homebrew and XAMPP, and still failed.
My OS is Mac OS Catalina.
Because I wasting so may time setting up the environment on the mac, I'm try to use my PC with Windows 10 installed. So here's my setup.
Platform: XAMPP
PHP: 7.1.28
With the same code and setup, I was able to run smoothly without any errors on Windows 10. So I think it shouldn't be a code problem (maybe).
Since I need to work with the Mac OS environment, I want someone to help me to give an idea on how to solve this problem. Thanks.
I am new to PHP and Laravel.
I installed Laravel and Composer , created new project and it is working fine.
Now when i tried to migrate a database using this command php artisan migrate i got errors, i wonder is it something related to not installing Xampp ? i am running Mac OS
The errors i got is
1 PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=app", "root", "", [])
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Xampp has nothing to do with Laravel itself. Xampp is a set of tools that is usually used together to deliver websites. Xampp just makes it easier (supposedly) to install those set for you. Rather than having to install and setup all yourself.
Today people tend to avoid such sets in favour for tools like Vagrant or Docker.
Laravel even provides its own Vagrant setup called Homestead.
See ie. in Laravel 5.5 docs: https://laravel.com/docs/5.5/homestead
If you don't want to use Homestead but build your own server environment there's also tools to make this easier for you.
For example there is http://www.puphpet.com for PHP + Vagrant and https://phpdocker.io/ for PHP + Docker.
Xampp is not required but a php server like apache or nginx is required also in order to use mysql you should have mysql installed you get this error
PDOException::("SQLSTATE[HY000] [2002] Connection refused")
/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
because the mysql service is turned off so I think you open Xampp control Panel and you start mysql in order for it to work and this is why you have asked if Xampp is required am I right !!!
Actually to prove that Xampp has nothing to do with Laravel you can start the mysql server from command line I will give you example in windows OS.
if you have xampp installed on C:/ Driver lets say then try cd(change directory) into this path in your command line
cd c:/xampp/mysql/bin
start mysqld.exe // this will start the mysql service for you
now you can navigate to your Laravel app and try to migrate this time you won't get connection refused error and that is because you have started the Mysql server from command line.
I think this proves that Xampp has nothing to do with Laravel.
Hope this was helpful, good luck.
Mac OS comes with PHP built into it. You should be able to use php -v to see what version. Use php -S localhost:xxxx to output the local directory to a local address.
For example, to run laravel locally, open the terminal cmd+spacebar, type terminal, open it, then use change to the path where your laravel project is.
Type php -S localhost:3000 and it should give you a confirmation in the terminal. Now open a browser and go to localhost:3000 and it should show your project.
I want to start using PHP Code Sniffer in PhpStorm but I am not sure how I can configure it for my environment.
I connect to a Windows server using RDP, PhpStorm is installed on this box.
My development server is a Centos VM.
Am I correct in thinking that I need to install PHP and PHP Code Sniffer on the Windows Server?
UPDATE
I tried following this https://confluence.jetbrains.com/display/PhpStorm/IDE+and+Project+Settings+in+PhpStorm
When I browse to phpcs and click Validate. I get an error which says that it is not a valid Windows application.
Should there be a batch file in there? The link says:
"Composer will install PHP Code Sniffer under the following path in your project: ./vendor/bin/phpcs and ./vendor/bin/phpcs.bat."
I added the batch file manually from here https://github.com/squizlabs/PHP_CodeSniffer/blob/master/bin/phpcs.bat
Now when I click the Validate button, I get:
#php_bin# is not recognised as an internal or external command
What next?
Do I need PHP on my Windows box?
I'm new to VS Code and the php world. My experience is more with heavyweight IDE such as Visual Studio. However, I have a need to setup a php environment on my dev machine and am having some trouble getting it to work properly.
My environment is a Win 10 dev machine. I am using VS Code and php ver 5.5. I have properly installed the xdebug extension and verified it is properly installed. I have also installed the php-debug extension in VS Code.
The challenge I'm having and have been unable to find any useful information through google is launching the php website from within VS Code and then being able to debug it.
A few things I have tried, but haven't worked.
I installed the iis-express extension to VS Code which allows for running any folder through iis express. https://marketplace.visualstudio.com/items?itemName=warren-buckley.iis-express
This works, but the website doesn't display properly. IIS returns an error message saying the site is not properly configured. It's apparently missing a mapping or something along those lines.
I followed this blog. http://blog.denouter.net/2015/05/run-php-from-visual-studio-code.html and am able to run the website using the built in php web server.
Installed webmatrix and let the windows platform installer correctly install and wire up iis express to work with php. The same folder works fine when running from webmatrix.
Installed the php-debug extension to VS Code. https://github.com/felixfbecker/vscode-php-debug
Here is what I think I'm missing. I believe I need to launch the website from within VS Code for the debugging to work. I can't figure out how to "launch" the php website from within VS Code. The php-debug extension from VS Code only supports launch. It doesn't support "attach" mode. I suspect this is why when I run the website outside VS Code, the debugger doesn't work. Let me be clear, the debugger is working when I hit F5, it just doesn't ever stop on any breakpoints.
To summarize: How can I launch and debug my php website from within VS Code? I'm looking for a detailed step by step guide.
Thank you
I am the author of vscode-php-debug. You do not need to "launch the website" from inside VS Code. When you start the "Listen for XDebug" configuration from the debug section, VS Code (or rather, my debug adapter) will listen on port 9000 for XDebug. You need to run a web server like Apache, IIS or nginx locally on your PC and configure it to serve PHP files - this has nothing to do with VS Code. Then simply open a web browser and navigate to localhost and XDebug will connect to the debugger, stopping on breakpoints.
The two necessary settings in php.ini are:
xdebug.mode = debug
xdebug.start_with_request = yes
(Do not forget to add the subtitle [XDebug] before the settings.
I have a problem with the netbeans7.3.1 when ever I try to run my php program i get this error from the browser : Unable to connect
Firefox can't establish a connection to the server at localhost:8000.
my interpreter location is : /usr/bin/php5
The project configuration : PHP Built-in Web Server (running on built- in web server)
my operating system is : Ubuntu linux.
I've been having this problem for more then 6 months now, I've looked and searched everywhere but I could not find the solution for this.
Just to mention that I had another problem with the interpreter it used to ask me to locate the interpreter every time i run netbeans , but i fixed this by installing php5.