Parse Error in php artisan migrate - laravel-5.1

php artisan migrate gives throws the following error.
[Symfony\Component\Debug\Exception\FatalErrorException] parse error,
expecting "identifier (T_STRING)"
How should I debug this? What are the possible reasons for this error?
PHP version = 5.5.24

Laravel requires a PHP version greater than or equal to 5.5.9 which is why you're getting this error.
If you update PHP it will solve the problem. Or for local development just use Laravel Homestead as it comes with all the necessary requirements.
For more info check out the documentation.

Related

SQLSTATE[HY000] [2002] No such file or directory in - api platform and symfony 6

I am running a docker project with symfony 6 and PHP 8 and I am getting the error:
"An exception occurred in the driver: SQLSTATE[HY000] [2002] No such
file or directory in . (which is being imported from
"/app/config/routes/api_platform.yaml"). Make sure there is a loader
supporting the "api_platform" type."
I'm trying to display GET request with api platform.
From this error I thought it might be the database connexion (mariadb database) but I checked and it was fine.
in my .env:
DATABASE_URL="mysql://admin#localhost:3307/databasetest"
the url of the symfony server with the swagger of api platform:
http://127.0.0.1:8000/api
I thought it was because the entity I used still had annotations instead of attribute despite being in symfony 6 so I used rector package to upgrade my entity file with attribute. I also added getter et setter to all properties.
I don't understand why the error is pointing toward api platform in the message?
I did run a similar project without docker and with a SQL database and it worked fine.
I had this in its .env:
DATABASE_URL="mysql://root#127.0.0.1:3306/databasetest?serverVersion=8&charset=utf8mb4"
I tried adding the version at the end but that's not it:
DATABASE_URL="mysql://admin#localhost:3307/databasetest?serverVersion=10&charset=utf8mb4"
(at least the DATABASE_URL with the version added, displays http://127.0.0.1:8000/api, but the error "An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory" is still present)
Any advice please?
edit: I thought I had the solution which is:
I am not sure when or why the problem was solved because I have tried
several things in between but using the service name for the
DATABASE_URL:
DATABASE_URL="mysql://admin#database:3306/databasetest" or
DATABASE_URL="mysql://admin#database:3306/databasetest?serverVersion=10&charset=utf8"
and it works... I tried this at the beginning I think? So I'm not sure
if the changes I tried really made it work
Thanks #Hans Kilian for pointing again the service name docker-compose
PHP instance seems not to communicate with db service
but no because I need to use:
DATABASE_URL="mysql://admin#database:3306/databasetest"
if I want to use api platform, but I need to use:
DATABASE_URL="mysql://admin#localhost:3307/databasetest"
if I want to change my data in the database, or use symfony commands such as "php bin/console make:migration" which result in error ""An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory" when doing API request on api platform
This is the docker-compose.yml:
services:
database:
ports:
- '3307:3306'
So my final problem is to find out a DATABASE_URL which make both the api platform work and symfony commands work, if someone have any advise...
I suggest you to add a container_name to your database service, so you will be able to call it as a network in your .env file:
###> doctrine/doctrine-bundle ###
database:
container_name: "my_database"
...
...
###< doctrine/doctrine-bundle ###
then replace localhost by the container name in your .env file:
DATABASE_URL="mysql://admin#my_database:3307/databasetest"
Be aware that I don't know if this is the best solution, but it works fine for development environment.

Exception with running Neo4j version 3 communitiy edition

I unpacked the tar file of Neo4j linux version.
When running the server (./bin start) it seems like the server is up, but I cant access the browser (although I get a message it is ready).
Running the console (./bin console) - returns an error: "Error: Could not find or load main class org.neo4j.server.CommunityEntryPoint"
Did anyone also encountered this issue? How can I solve this?
Thank you
How did you run ./bin console? I'm curious since such a thing does not exist.
To start up the database you use bin/neo4j start - then you point your browser to localhost:7474.
For command line based access use bin/neo4j-shell.

Getting 404 File Not Found on Apache 2.4, FastCGI and Ubuntu 14.04

My first step was install HHVM following this guide: https://github.com/facebook/hhvm/wiki/Prebuilt-packages-on-Ubuntu-14.04
Then i run the script with the command: ´sudo /usr/share/hhvm/install_fastcgi.sh
Then i test if hhvm was installed with command ´php -v´ and the output is OK, says that HIPHOP VM is runing.
The problem arrives when i try to access to a PHP file, Apache always return 404 error. In the other hand html files and static files works good. I only receive 404 error with php files.
I search on Google and found many people with same issue but no solutions. Perhaps someone can help.

Connecting to an Oracle database with ROracle on shiny-server

We recently were able to get a small redhat server to experiment with shiny-server. Our IT department got shiny-server running and installed the Oracle client but I can't get ROracle to work in shiny-server. They (IT) have decided that it is an application issue and are starting to give up...
Initially ROracle didn't work on the server at all but we got it working from my user account by setting the LD_LIBRARY_PATH in my .bashrc file. With that done I can log into the server, and query the database from R. I can even use runApp() to run my shiny app from R.
When I try to access that same app through shiny-server I get the following error:
Listening on port 40679
Loading required package: DBI
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
libclntsh.so.11.1: cannot open shared object file: No such file or directory
Error : package or namespace load failed for 'ROracle'
Error : package or namespace load failed for 'ROracle'
which is the same error I was getting on my account before I set the LD_LIBRARY_PATH variable. The server is running as user shiny but apparently won't run any startup scripts so what fixed it for my user won't fix it for the shiny user. This is all very far outside my area of knowledge and as I said, our IT department says they are out of ideas.
I don't have sudo access to the server so the things I can try are limited. I tried setting the LD_LIBRARY_PATH from my server.R script before loading ROracle with Sys.setenv() and by using system() but those didn't work. Our DBA that has been trying to help me tried setting the LD_LIBRARY_PATH in /etc/init/shiny-server.conf but that doesn't seem to work either.
I am really hoping that someone here has some ideas.
Thanks
After a couple of frustrating days I found the solution. You need to set the LD_LIBRARY_PATH variable in the upstart script located at /etc/init/shiny-server.conf, but per the upstart documentation, you need to define it with the env keyword. So adding:
env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
to beginning of the shiny-server.conf script seems to have fixed the problem.
Here's my blog post (about a year old) with a detailed description on how to get R Studio Server going with Oracle. LD_LIBRARY_PATH, OCI Lib and all the stuff is provided. Maybe this helps someone else: http://learnfrominfo.tumblr.com/post/38382388429/connect-r-studio-server-to-an-oracle-database-with
I had the same problem with PHP and Apache.
Please refer to the Setting the Oracle Environment in the PHP documentation.
Also, see comment - which syntax did you use in /etc/init/shiny-server.conf?
SERVER.R
library
library(RMySQL)
library(caTools)
library(rpart)
library(RJDBC)
shinyServer(
function(input ,output)
{
dvr =JDBC("oracle.jdbc.OracleDriver",classPath="D:/ojdbc6.jar")
url = ""
user = ""
password = ""
jd =dbConnect(dvr,url, user, password)
a1 <- eventReactive(input$predict,
{
a<-input$ref
table2<-data.frame(dbGetQuery(jd,paste0("
select colnames from Tablename where REFNO=",a," and ROWNUM<15
")))
print(table2)
print(bs<-table2)
}
)
output$dis<-renderTable({
a1()
})
}
)

symfony plugin installation failing [bhLDAPAuthPlugin]

I'm working on a symfony project and I need a user access conected to an LDAP server. So I searched for something already done to add to my app and found this plugin that has all I wanted.
So I tried to install with the command $ php symfony plugin:install bhLDAPAuthPlugin
for some reason it throws me this error:
No release avaiable for plugin "bhLDAPAuthPlugin"
I don't really understand what that message means. I've checked the spell of the command (also copied the command given in the page of the plugin) and same error appears. If I had no all requeriments for instalation, other errors would be thrown, right?
PS: If you know some easy way to implement by myself the comunication with LDAP (Microsoft Active Directory) will also be appreciated.
No exactly sure how to solve the error message, perhaps it helps is specifically specify which version you wish to install.
Otherwise there's an easy workaround:
Just download the tgz file from here:
http://www.symfony-project.org/plugins/bhLDAPAuthPlugin/6_0_0
and do
php symfony plugin:install bhLDAPAuthPlugin-etc-etc.tgz

Resources